error 029: invalid expression, assumed zero - 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: error 029: invalid expression, assumed zero (
/showthread.php?tid=393985)
error 029: invalid expression, assumed zero -
ThePhill97 - 20.11.2012
I have this error:
pawn Код:
(4198) : error 029: invalid expression, assumed zero
This is line 4198
This is the script its in
pawn Код:
if(pickupid == copdutypoint)
if(GetPlayerTeam(playerid) == 100) GivePlayerWeapon(playerid, 3, 1); GivePlayerWeapon(playerid, 22, 99); GivePlayerWeapon(playerid, 27, 50);
else
SendClientMessage(playerid, 0xAA3333AA, "You can't go on duty! You're not a cop");
Its in OnPlayerPickupPickup I have two others, its fine.. I think its the multiple functions im trying to give this one?
Re: error 029: invalid expression, assumed zero - Patrick - 20.11.2012
try this one
pawn Код:
if(pickupid == copdutypoint)
if(GetPlayerTeam(playerid) == 100) //get the player team if cop
{
GivePlayerWeapon(playerid, 3, 1);//weapon 1 you set
GivePlayerWeapon(playerid, 22, 99); //weapon 2 you set
GivePlayerWeapon(playerid, 27, 50);//weapon 2 you set
}
SendClientMessage(playerid, 0xAA3333AA, "You can't go on duty! You're not a cop");// message if they are not cop
return 1;
}
Re: error 029: invalid expression, assumed zero -
iggy1 - 20.11.2012
pawn Код:
if(pickupid == copdutypoint)
{
if(GetPlayerTeam(playerid) == 100)
{//you need opening and closing braces if more than one statement follows the if
GivePlayerWeapon(playerid, 3, 1);
GivePlayerWeapon(playerid, 22, 99);
GivePlayerWeapon(playerid, 27, 50);
}
else//only one statement following the else, so braces can be omitted.
SendClientMessage(playerid, 0xAA3333AA, "You can't go on duty! You're not a cop");
}
You could also use comma's without braces but it looks ugly IMO.
EDIT:
Quote:
Originally Posted by pds2012
pawn Код:
if(pickupid == copdutypoint) if(GetPlayerTeam(playerid) == 100) //get the player team if cop { GivePlayerWeapon(playerid, 3, 1);//weapon 1 you set GivePlayerWeapon(playerid, 22, 99); //weapon 2 you set GivePlayerWeapon(playerid, 27, 50);//weapon 2 you set { SendClientMessage(playerid, 0xAA3333AA, "You can't go on duty! You're not a cop");// message if they are not cop return 1; }//wheres the opening brace?
|
Your missing braces again.