Pls help me with this error - 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: Pls help me with this error (
/showthread.php?tid=633519)
Pls help me with this error -
xskyowned - 02.05.2017
new countpolicemen=0;
for (new d=0;d<MAX_PLAYERS;d++)if(IsPlayerConnected(d) && PlayerInfo[d][pfaction]==FACTION_POLICE)countpolicemen++; ***
if(countpolicemen<3)return SendClientMessage(playerid,COLOR_NO,"You need 3 cops online in orther to do a robbery.");
ERROR TYPE: : error 001: expected token: ")", but found "-identifier-"
ERROR LINE (THAT ONE WITH AT THE END ***)
Please help me..
Re: Pls help me with this error -
sampkinq - 02.05.2017
Код:
for(new d = 0; d < MAX_PLAYERS; d++) if(IsPlayerConnected(d)) && PlayerInfo[d][pfaction] == FACTION_POLICE) countpolicemen++;
if(countpolicemen < 3) return SendClientMessage(playerid, COLOR_NO, "You need 3 cops online in orther to do a robbery.");
Re: Pls help me with this error -
xskyowned - 02.05.2017
Quote:
Originally Posted by sampkinq
Код:
for(new d = 0; d < MAX_PLAYERS; d++) if(IsPlayerConnected(d)) && PlayerInfo[d][pfaction] == FACTION_POLICE) countpolicemen++;
if(countpolicemen < 3) return SendClientMessage(playerid, COLOR_NO, "You need 3 cops online in orther to do a robbery.");
|
At the same line, now there are two errors.
error 029: invalid expression, assumed zero
error 001: expected token: ";", but found "-identifier-"
Re: Pls help me with this error -
AndreiWow - 02.05.2017
You need brackes like
for() {
}
also for the if...
Re: Pls help me with this error -
xskyowned - 02.05.2017
Quote:
Originally Posted by AndreiWow
You need brackes like
for() {
}
also for the if...
|
I used this script also two years ago. In the same status...... and it worked well
Re: Pls help me with this error -
AndreiWow - 02.05.2017
This is how an if statement should look, notice the brackets.
https://sampwiki.blast.hk/wiki/Control_Structures
Here you can find the for loop and see how it looks, notice the brackets.
https://sampwiki.blast.hk/wiki/Loops
Try adding brackets to your code like
PHP код:
for(arguments){
if(condition){
}
}
Re: Pls help me with this error -
sampkinq - 02.05.2017
Quote:
Originally Posted by xskyowned
At the same line, now there are two errors.
error 029: invalid expression, assumed zero
error 001: expected token: ";", but found "-identifier-"
|
Код:
for(new d = 0; d < MAX_PLAYERS; d++)
{
if(IsPlayerConnected(d))
{
if(PlayerInfo[d][pfaction] == FACTION_POLICE)
{
countpolicemen++;
}
}
}
if(countpolicemen < 3) return SendClientMessage(playerid, COLOR_NO, "You need 3 cops online in orther to do a robbery.");