Question about block for "all" players - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question about block for "all" players (
/showthread.php?tid=166402)
Question about block for "all" players -
xfelipex - 08.08.2010
I know that if : new block[MAX_PLAYERS]; and put in a code :
Код:
if(strcmp("/block",cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, vermelho, "lol");
block[playerid]=1;
}
else { if(block[playerid]=1)
return SendClientMessage(playerid, vermelho, "blocked already");
}
return 1;
}
But I dont know how to block to "all" of players after certain code or action ,as the one Im trying to do : a house just for fun
I know that this is the code for "all " players :
Код:
for(new v = 0; v < MAX_VEHICLES; ++v)
But how to mix it with a command which will block certain action after another certain - Sorry if anything wrong on this text. But I bet there's no.
Re: Question about block for "all" players -
JaTochNietDan - 08.08.2010
Well your first bit of code is flawed in a few ways. You're doing the else if statement on the strcmp check, not on a block check. This would be a better way of doing it.
pawn Код:
if(strcmp("/block",cmdtext, true, 10) == 0)
{
if(block[playerid] == 0)
{
SendClientMessage(playerid, vermelho, "lol");
block[playerid]=1;
}
else return SendClientMessage(playerid, vermelho, "blocked already");
return 1;
}
Also your if statement was wrong.
= assigns a value to a variable
== checks if a variable is equal to a value
As for the loop
pawn Код:
for(new v = 0; v < MAX_VEHICLES; ++v)
You don't loop through all possible vehicle ID's just to set a value for players. This is what you want
pawn Код:
for(new v = 0; v < MAX_PLAYERS; ++v)
{
if(IsPlayerConnected(v))
block[v] = 1;
}
Re: Question about block for "all" players -
xfelipex - 08.08.2010
oh god, thank you. Im not being smart enough actually for think it o. o