15.10.2011, 13:42
Im attempting to implement a simple 24/7 shop dialog i got from Sa-mp Wiki my only errors are the following.
What am i doing wrong? Can someone help me correct these and explain it as well?
Lines
What am i doing wrong? Can someone help me correct these and explain it as well?
pawn Код:
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(91) : warning 201: redefinition of constant/macro (symbol "CMD:%1(%2)")
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(2080) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(2080 -- 2081) : error 028: invalid subscript (not an array or too many subscripts): "response"
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(2080 -- 2082) : error 001: expected token: "}", but found "switch"
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(2080 -- 2082) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
pawn Код:
if(response)// line 2080
{ //line 2081
switch(7)//line 2081
pawn Код:
if(response)// They pressed the first button.
{
switch(7)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
case 7:// Our dialog!
{
switch(listitem)// Checking which listitem was selected
{
case 0:// The first item listed
{
if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
}
case 1: // The second item listed
{
if(GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -2);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
}
case 2: // The third item listed
{
if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -3);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
}
}
}
}
return 1;
}


