SA-MP Forums Archive
Problem with OnDialogResponse - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with OnDialogResponse (/showthread.php?tid=457285)



Problem with OnDialogResponse - NinjahZ - 10.08.2013

I have been trying to use "switch's" and I have really screwed my OnDialogResponse section up
Does anyone know how to fix this?
I know I have put Switch's in the wrong area but I do not know where......
Here is the errors I get
Код:
C:\Users\NinjahZ\Desktop\Secret Project\gamemodes\sp.pwn(1559) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\NinjahZ\Desktop\Secret Project\gamemodes\sp.pwn(1559) : warning 215: expression has no effect
C:\Users\NinjahZ\Desktop\Secret Project\gamemodes\sp.pwn(1560) : warning 209: function "S@@_OnDialogResponse" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
1 Error.
Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
if you need to see the code,check it here
https://gist.github.com/NinjahZ/317d0d5c23356bf74664
if you can help,that would be very nice of you


Re: Problem with OnDialogResponse - NinjahZ - 10.08.2013

You mean to tell me it is just a indent problem?
Hey did you have connectivity problem yesterday? The whole Forum would not load for me at all....


Re: Problem with OnDialogResponse - NinjahZ - 10.08.2013

Okay....


Re : Problem with OnDialogResponse - Naruto_Emilio - 10.08.2013

add a } before return 1;


Re: Problem with OnDialogResponse - NinjahZ - 10.08.2013

No I found what I did wrong :P I fixed it
https://gist.github.com/NinjahZ/13b5d57a9425045365e8


Re : Problem with OnDialogResponse - Naruto_Emilio - 10.08.2013

Read what I wrote, there was a missing brack "}" before the return 1; in the end....


Re: Problem with OnDialogResponse - JusstinRoller - 11.08.2013

pawn Код:
case SHOP_MENU:
{
if ( !response ) return SendClientMessage(playerid, -1, "You exited the Shop Menu!");
if( response )
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) > 999)
{
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 34,80);
SendClientMessage(playerid, -1, "You Have Bought 80 Shell's of Sniper Ammo");
}
else SendClientMessage(playerid, -1, "ERROR: You Don't Have Enough Money To Buy A Sniper!");
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) > 499)
{
SetPlayerArmour(playerid,100);
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, -1, "You Have Bought Full Armour");
}
}
else SendClientMessage(playerid, -1, "ERROR: You Don't Have Enough Money To Buy Armour!");
}
}
return 1; //line 1559
}
You shout make the else SendClientMessage You don't have enough money like this

pawn Код:
case SHOP_MENU:
{
if ( !response ) return SendClientMessage(playerid, -1, "You exited the Shop Menu!");
if( response )
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) > 999)
{
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 34,80);
SendClientMessage(playerid, -1, "You Have Bought 80 Shell's of Sniper Ammo");
}
else SendClientMessage(playerid, -1, "ERROR: You Don't Have Enough Money To Buy A Sniper!");
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) > 499)
{
SetPlayerArmour(playerid,100);
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, -1, "You Have Bought Full Armour");
}
}
else SendClientMessage(playerid, -1, "ERROR: You Don't Have Enough Money To Buy Armour!");
}
}
}
return 1; //line 1559
}
You missing the "{" after the else sendclientmessage but anyway you just use
pawn Код:
switch(listitem)
{
    case 0:
    {
        //Your code
    }
    case 1:
    {
        //Your code
    }
}
Edit: Late.


Re: Problem with OnDialogResponse - NinjahZ - 11.08.2013

http://www.colorpicker.com/ at the top of the color picker it has code....