[HELP] Checking for player with something parameters - 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: [HELP] Checking for player with something parameters (
/showthread.php?tid=182463)
[HELP] Checking for player with something parameters -
Pooh7 - 10.10.2010
Hello
I'm making my own anticheat.
So, I want to checking every x seconds for online admins. And, if 1+ admins online, and cheater is on a server, server will sent message to online admins with name of cheater, etc. But, if is no admins there, and cheater is on a server, server will be display message to all players that is this player cheater and kick him. (For example, anti jetpack)
So, how to make checking for online admins??
Re: [HELP] Checking for player with something parameters -
JaTochNietDan - 10.10.2010
You can check for online administrators using something like so:
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(i)) SendClientMessage(i,color,"This person is an admin, send him the message");
}
If you're using a specific administration script besides RCON, then you'd need to replace IsPlayerAdmin(i) with whatever variable the script uses to track someone being an administrator or not.
Re: [HELP] Checking for player with something parameters -
Pooh7 - 10.10.2010
Hmm, I think I don't understand
![Smiley](images/smilies/smile.png)
Explain me, please, how to check every X seconds for online admins, and if no admins there, than to send message to everyone that no admins online, for example.
Re: [HELP] Checking for player with something parameters -
JaTochNietDan - 10.10.2010
Okay...well you would need a timer OnGameModeInit like so:
pawn Код:
SetTimer("CheckAdmins",60000,true); // Run the CheckAdmins function every 60 seconds
Then make a new public function for CheckAdmins like:
pawn Код:
public CheckAdmins()
{
new adminsonline = 0;
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(i)) adminsonline++;
}
if(adminsonline == 0) SendClientMessageToAll(color,"No admins are online");
return 1;
}
Is that what you're looking for?
Re: [HELP] Checking for player with something parameters -
Cameltoe - 10.10.2010
Learn the basics first
Go to the Samp wiki and search for:
SetTimer
SendClientMessage
format
Also :
Quote:
Originally Posted by JaTochNietDan
Okay...well you would need a timer OnGameModeInit like so:
pawn Код:
SetTimer("CheckAdmins",60000,true); // Run the CheckAdmins function every 60 seconds
Then make a new public function for CheckAdmins like:
pawn Код:
public CheckAdmins() { new adminsonline = 0; for(new i; i < MAX_PLAYERS; i++) { if(IsPlayerAdmin(i)) adminsonline++; } if(adminsonline == 0) SendClientMessageToAll(color,"No admins are online"); return 1; }
|
Could help you out a bit