Problem with OnDialogResponse
#1

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
Reply
#2

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....
Reply
#3

Okay....
Reply
#4

add a } before return 1;
Reply
#5

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

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

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.
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)