[HELP] Checking for player with something parameters
#1

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??
Reply
#2

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.
Reply
#3

Hmm, I think I don't understand
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.
Reply
#4

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?
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)