PDA

View Full Version : Problem with OnDialogResponse


NinjahZ
11/08/2013, 12:07 AM
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 (c) 1997-2006, ITB CompuPhase
1 Error.
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 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 :)

NinjahZ
11/08/2013, 12:31 AM
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....

NinjahZ
11/08/2013, 12:40 AM
Okay....

Naruto_Emilio
11/08/2013, 12:48 AM
add a } before return 1;

NinjahZ
11/08/2013, 12:54 AM
No I found what I did wrong :P I fixed it
https://gist.github.com/NinjahZ/13b5d57a9425045365e8

Naruto_Emilio
11/08/2013, 12:56 AM
Read what I wrote, there was a missing brack "}" before the return 1; in the end....

JusstinRoller
11/08/2013, 01:00 AM
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

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
switch(listitem)
{
case 0:
{
//Your code
}
case 1:
{
//Your code
}
}

Edit: Late.

NinjahZ
11/08/2013, 02:39 AM
http://www.colorpicker.com/ at the top of the color picker it has code....