Sziasztok!
Lenne egy kis problémám a drog rendszeremmel, mégpedig a dialog nem megy tovább mintha mi sem törtnét volna.
Lehet egy kicsit furán hangzik, de mikor dialogból megakarom venni a drogot nem csinál semmit.
A script a következõ:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/drog\", cmdtext, true, 10) == 0)
{
if(high[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, \" Nem használhatod, míg be vagy szívva!\");
return 1;
}
ShowPlayerDialog(playerid, DRUGUSE, DIALOG_STYLE_LIST, \"Drogok\",\"Heroin\\nMariuhána\",\"Használ\",\"Kilépés\");
return 1;
}
if(strcmp(cmdtext, \"/drogvesz\", true) == 0)
{
if (PlayerToPoint(1, playerid,-393.7396, 2249.6177, 42.4297)) // drog hely
{
ShowPlayerDialog(playerid, 566, DIALOG_STYLE_LIST, \"Drog\",\"Heroin $10000\\nMariuhána $5000\",\"Vásárlás\",\"Kilépés\");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW,\"Rossz helyen vagy !\");
return 1;
}
}
return 0;
}
forward DrugSave(playerid);
public DrugSave(playerid)
{
OnPlayerConnect(playerid);
return 1;
}
public OnPlayerConnect(playerid)
{
new file[100],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,24);
format(file,sizeof(file),\"Drugs\\%s.ini\",pName);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file,\"Heroin\",heroin[playerid]);
dini_IntSet(file,\"Mariuhána\",weed[playerid]);
}
else
{
heroin[playerid] = dini_Int(file,\"Heroin\");
weed[playerid] = dini_Int(file,\"Mariuhána\");
}
return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf(\"DEBUG: X:%f Y:%f Z:%f\",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
public DrugsOff(playerid)
{
if(IsPlayerConnected(playerid))
{
SetCameraBehindPlayer(playerid);
SetPlayerDrunkLevel(playerid, 0);
SetPlayerWeather(playerid, 2);
high[playerid] = 0;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == USEWEED)
{
if(response)
{
new Float:Health,Float:Armour; GetPlayerHealth(playerid,Health); GetPlayerArmour(playerid,Armour);
SetPlayerArmour(playerid,Armour+15);
weed[playerid] -= 1;
SetPlayerWeather(playerid, -84);
SetPlayerDrunkLevel(playerid, 10000);
SetPlayerTime(playerid,4,00);
high[playerid] = 1;
GameTextForPlayer(playerid, \"~r~Beszívtál!\",3500,5);
SetTimerEx(\"DrugsOff\", 60000, false, \"i\", playerid);
}
if(!response)
{
ShowPlayerDialog(playerid, DRUGUSE, DIALOG_STYLE_LIST, \"Drog\",\"Heroin\\nMariuhána\",\"Használ\",\"Kilépés\");
}
}
if(dialogid == USEHERO)
{
if(response)
{
new Float:Health,Float:Armour; GetPlayerHealth(playerid,Health); GetPlayerArmour(playerid,Armour);
heroin[playerid] -= 1;
SetPlayerArmour(playerid,Armour+20);
SetPlayerWeather(playerid, -66);
SetPlayerDrunkLevel(playerid, 10000);
SetPlayerTime(playerid,12,00);
GameTextForPlayer(playerid, \"~r~A drog hatása pár perc múlva elmúlik\",3500,5);
high[playerid] = 1;
SetTimerEx(\"DrugsOff\", 60000, false, \"i\", playerid);
}
if(!response)
{
ShowPlayerDialog(playerid, DRUGUSE, DIALOG_STYLE_LIST, \"Drog\",\"Heroin\\nMariuhána\",\"Használ\",\"Kilépés\");
}
}
if(dialogid == DRUGUSE)
{
if(response)
{
if(listitem == 0)
{
if(heroin[playerid] >= 1)
{
ShowPlayerDialog(playerid, USEHERO, DIALOG_STYLE_MSGBOX, \"Heroin\",\"Heroinozni akarsz ?\",\"Igen\",\"Nem\");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, \" Nincs heroinod\");
}
}
if(listitem == 1)
{
if(weed[playerid] >= 1)
{
ShowPlayerDialog(playerid, USEWEED, DIALOG_STYLE_MSGBOX, \"Mariuhána\",\"Füvezni akarsz ?\",\"Igen\",\"Nem\");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, \" Nincs mariuhánád\");
}
}
}
}
if(dialogid == 568)
{
if(response)
{
GivePlayerMoney(playerid, -weedprice);
weed[playerid] += 5;
SendClientMessage(playerid, COLOR_YELLOW, \"Vettél 5 gramm Mariuhánát\");
SendClientMessage(playerid, COLOR_YELLOW, \"HASZNÁLAT: /drog\");
}
if(!response)
{
SendClientMessage(playerid, COLOR_YELLOW, \" Gyere vissza késõbb is ! (( ))\");
}
}
if(dialogid == 567)
{
if(response)
{
GivePlayerMoney(playerid, -heroprice);
heroin[playerid] += 5;
SendClientMessage(playerid, COLOR_YELLOW, \"Vettél 5 gramm heroint\");
SendClientMessage(playerid, COLOR_YELLOW, \"HASZNÁLAT: /drog\");
}
if(!response)
{
SendClientMessage(playerid, COLOR_YELLOW, \" Gyere vissza késõbb is ! (( ))\");
}
}
if(dialogid == 566)
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 50000) return SendClientMessage(playerid, COLOR_YELLOW, \"Nincs elég pénzed!\");
{
ShowPlayerDialog(playerid, 567, DIALOG_STYLE_MSGBOX, \"Heroin\",\"Venni akarsz 5 gramm heroint {FF0000}$50000-ért?\",\"Igen\",\"Nem\");
}
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) < 40000) return SendClientMessage(playerid, COLOR_YELLOW, \"Nincs elég pénzed!\");
{
ShowPlayerDialog(playerid, 568, DIALOG_STYLE_MSGBOX, \"Mariuhána\",\"Venni akarsz 5 gramm Mariuhánát {FF0000}$40000-ért?\",\"Igen\",\"Nem\");
}
}
}
}
return 1;
}