HelpMe #8 [+REP] - 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: HelpMe #8 [+REP] (
/showthread.php?tid=299016)
HelpMe #8 [+REP] -
NessaHD - 23.11.2011
Hey guys, i want to make a unique filterscript but i need yo help..
How can i for example define a computer?
Like, when a player types a command then it checks if he have a computer or not. If he do, then let the command process, if not then tell a error.
Psst, yeap im a newbie scripter, but thats why those forums are here.
Re: HelpMe #8 [+REP] -
Fj0rtizFredde - 23.11.2011
You could make this really easy by just using a variable:
pawn Код:
new PlayerHasComputer[MAX_PLAYERS]; //At the top of your script
//OnPlayerConnect:
PlayerHasComputer[playerid] = 0; //Nobody has a computer when they join the server.
//Your command:
if(!PlayerHasComputer[playerid]) return SendClientMessage(playerid,-1,"You dont have a computer so you can't use this command");
//Where you want people to get a computer from add:
PlayerHasComputer[playerid] = 1;
Note: This was writen right in the forums just as an example.
Re: HelpMe #8 [+REP] - Sinc - 23.11.2011
Quote:
Originally Posted by cruteX_modshop
Hey guys, i want to make a unique filterscript but i need yo help..
How can i for example define a computer?
Like, when a player types a command then it checks if he have a computer or not. If he do, then let the command process, if not then tell a error.
Psst, yeap im a newbie scripter, but thats why those forums are here. 
|
Boolean data types contains values of either true or false expressions. Initialize the array as MAX_PLAYERS.
pawn Код:
new
bool:var[MAX_PLAYERS],
counter
;
stock loop()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(var[i] == true)
{
counter++;
}
else
return 0;
}
printf("%d people have computers.",counter);
}
Re: HelpMe #8 [+REP] -
NessaHD - 23.11.2011
Umm the first post was more simply. Thx.