17.04.2014, 09:22
What's the difference between the "else" and other "if" ?
Note that your code DOESN'T match a non-response action.
It matches if the listitem isn't 0, 1, 2, 3, 4 or 5.
Do like that :
I repaired the error (normally).
Try, tell us, then if it works, ask you what's different between my code and yours.
Note that your code DOESN'T match a non-response action.
It matches if the listitem isn't 0, 1, 2, 3, 4 or 5.
Do like that :
PHP код:
if(dialogid == 1)
{
if(response)
{
switch(listitem)
{
case 0:
{
GivePlayerMoney(playerid, -150);
GivePlayerWeapon(playerid, 14, 1);
return SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit o floare pentru {00FF40}150${FFFFFF}.");
}
case 1:
{
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 23, 50);
return SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un SILENCED 9MM cu 50 gloante pentru {00FF40}1.500${FFFFFF}.");
}
case 2:
{
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 24, 60);//deagle
return SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un DEAGLE cu 60 gloante pentru {00FF40}2.500${FFFFFF}.");
}
case 3:
{
GivePlayerMoney(playerid, -3500);
GivePlayerWeapon(playerid, 25, 25);
return SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un Shotgun cu 25 gloante pentru {00FF40}3.500${FFFFFF}.");
}
case 4:
{
GivePlayerMoney(playerid, -4500);
GivePlayerWeapon(playerid, 29, 50);
return SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un MP5 cu 50 gloante pentru {00FF40}4.500${FFFFFF}.");
}
case 5:
{
GivePlayerMoney(playerid, -5500);
GivePlayerWeapon(playerid, 31, 100);
return SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un M4 cu 100 gloante pentru {00FF40}5.500${FFFFFF}.");
}
}
}
else return SendClientMessage(playerid, COLOR_GREY, "* Ai decis sa nu cumperi arme *");
}
Try, tell us, then if it works, ask you what's different between my code and yours.