PDA

View Full Version : [HELP] Dialog


monster010
17/04/2014, 10:05 AM
I have this script:


if(dialogid == 1)
{
if(response)
{
if(listitem == 0)
{
GivePlayerMoney(playerid, -150);
GivePlayerWeapon(playerid, 14, 1);
SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit o floare pentru {00FF40}150${FFFFFF}.");
}
if(listitem == 1)
{
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 23, 50);
SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un SILENCED 9MM cu 50 gloante pentru {00FF40}1.500${FFFFFF}.");
}
if(listitem == 2)
{
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 24, 60);//deagle
SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un DEAGLE cu 60 gloante pentru {00FF40}2.500${FFFFFF}.");
}
if(listitem == 3)
{
GivePlayerMoney(playerid, -3500);
GivePlayerWeapon(playerid, 25, 25);
SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un Shotgun cu 25 gloante pentru {00FF40}3.500${FFFFFF}.");
}
if(listitem == 4)
{
GivePlayerMoney(playerid, -4500);
GivePlayerWeapon(playerid, 29, 50);
SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un MP5 cu 50 gloante pentru {00FF40}4.500${FFFFFF}.");
}
if(listitem == 5)
{
GivePlayerMoney(playerid, -5500);
GivePlayerWeapon(playerid, 31, 100);
SendClientMessage(playerid, 0xFFFFFFC8, "{FFFFFF}Ai primit un M4 cu 100 gloante pentru {00FF40}5.500${FFFFFF}.");
}
else // Pressed ESC or clicked cancel
{
SendClientMessage(playerid, COLOR_GREY, "* Ai decis sa nu cumperi arme *");
return 1;
}
}
return 1;
}


When I select a option, I appear like I press "EXIT". And When O select "EXIT" Nothing happens.


A PICTURE [click] (http://i60.tinypic.com/11kcw03.png)

S4t3K
17/04/2014, 10:22 AM
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 :


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 *");
}

I repaired the error (normally).
Try, tell us, then if it works, ask you what's different between my code and yours.