Little Error -
wahyumahadir - 11.02.2015
hello i've error in dialog
How to fix it ?
error:
Код:
C:\Users\win 8.1\Downloads\trucking\filterscripts\wahyu.pwn(640) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\win 8.1\Downloads\trucking\filterscripts\wahyu.pwn(640 -- 641) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Code
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 7777) // as mentioned above. Dialogs make each dialog type unique. Each new dialog, has to have a new ID
{
if(!response)
return 1;
switch(listitem) // heres the case number for the dialogs in the shop. remember to update here so each case matches dialog. EG: bike will give you a bike and not a spraycan
{
case 0:
{
if(GetPlayerMoney(playerid) < 1000)
return SendClientMessage(playerid, 0, "You do not have enough cash");
GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid,100);
}
case 1:
{
if(GetPlayerMoney(playerid) <1000)
return SendClientMessage(playerid,-1, "You do not have enough cash");
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 41,1000);
}
case 2:
{
if (GetPlayerMoney(playerid) <3000)
return SendClientMessage(playerid,-1,"You do not have enough cash");
GivePlayerMoney(playerid, -3000);
new Float:p[4];
GetPlayerPos(playerid, p[0], p[1], p[2]); // this creates a vehicle (being the bike) at the players position.
GetPlayerFacingAngle(playerid, p[3]);
CreateVehicle(510, p[0], p[1], p[2], p[3]+90, -1, -1, 9999999);
}
case 3:
{
if (GetPlayerMoney(playerid) <5000) // checks if the player has enough cash.
return SendClientMessage(playerid,-1,"You do not have enough cash"); //tells the player they dont have enough
GivePlayerMoney(playerid, -5000); //takes the money
GivePlayerWeapon(playerid, 10, 1); // gives the player the weapon
}
if(dialogid == 9980) // this is line 640
{
if(listitem == 5)
{
if(IsPlayerConnected(playerid))
{
ShowRules(playerid);
SendClientMessage(playerid,COLOR_GREY, "Press ENTER, if you dont want see rules anymore ");
ViewingRules[playerid] = 1;
}
}
if(listitem == 6)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,RED,"{FF0000}You are not in RCON admin!");
format(string, sizeof(string), "[ADMIN]: %s Showed the Rules to Everyone.", sendername);
ABroadCast(COLOR_LIGHTRED, string, 5);
SendClientMessageToAll(COLOR_GREY, "* {003399}Press ENTER,{339933} if you dont want see rules anymore .");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowRules(i);
ViewingRules[i] = 1;
}
}
}
if(listitem == 7)
{
SendClientMessage(playerid,COLOR_GREY, "{00FF66}Usage :{003399} /showrules [ID] ");
}
if(listitem == 8)
{
SendClientMessage(playerid,COLOR_GREY, "{00FF66}Usage :{003399} /ruleshelp ");
}
}
}
return 0;
}
Re: Little Error -
HazardouS - 11.02.2015
You were missing two closing brackets before line 640.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 7777) // as mentioned above. Dialogs make each dialog type unique. Each new dialog, has to have a new ID
{
if(!response) return 1;
switch(listitem) // heres the case number for the dialogs in the shop. remember to update here so each case matches dialog. EG: bike will give you a bike and not a spraycan
{
case 0:
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0, "You do not have enough cash");
GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid,100);
}
case 1:
{
if(GetPlayerMoney(playerid) <1000) return SendClientMessage(playerid,-1, "You do not have enough cash");
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 41,1000);
}
case 2:
{
if (GetPlayerMoney(playerid) <3000) return SendClientMessage(playerid,-1,"You do not have enough cash");
GivePlayerMoney(playerid, -3000);
new Float:p[4];
GetPlayerPos(playerid, p[0], p[1], p[2]); // this creates a vehicle (being the bike) at the players position.
GetPlayerFacingAngle(playerid, p[3]);
CreateVehicle(510, p[0], p[1], p[2], p[3]+90, -1, -1, 9999999);
}
case 3:
{
if (GetPlayerMoney(playerid) <5000) // checks if the player has enough cash.
return SendClientMessage(playerid,-1,"You do not have enough cash"); //tells the player they dont have enough
GivePlayerMoney(playerid, -5000); //takes the money
GivePlayerWeapon(playerid, 10, 1); // gives the player the weapon
}
}
}
if(dialogid == 9980) // this is line 640
{
if(listitem == 5)
{
if(IsPlayerConnected(playerid))
{
ShowRules(playerid);
SendClientMessage(playerid,COLOR_GREY, "Press ENTER, if you dont want see rules anymore ");
ViewingRules[playerid] = 1;
}
}
if(listitem == 6)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,RED,"{FF0000}You are not in RCON admin!");
format(string, sizeof(string), "[ADMIN]: %s Showed the Rules to Everyone.", sendername);
ABroadCast(COLOR_LIGHTRED, string, 5);
SendClientMessageToAll(COLOR_GREY, "* {003399}Press ENTER,{339933} if you dont want see rules anymore .");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowRules(i);
ViewingRules[i] = 1;
}
}
}
if(listitem == 7)
{
SendClientMessage(playerid,COLOR_GREY, "{00FF66}Usage :{003399} /showrules [ID] ");
}
if(listitem == 8)
{
SendClientMessage(playerid,COLOR_GREY, "{00FF66}Usage :{003399} /ruleshelp ");
}
}
return 0;
}
Re: Little Error -
ATGOggy - 11.02.2015
Lol, close the switch first