[+REP]Sending messages to admins.
#1

Hi guys. i have an anti cheat filterscript but its fully to my likings but the only problem is that the anti cheat warnings are sent to all players so i want it to just be sent to admins.Any way to do it? The script is using SendClientMessageToAll for that warnings but i want it to be sent only to admins. And my gamemode uses "pAdmin" for admin level.
Reply
#2

Very simple:

Код:
for(new i; i < MAX_PLAYERS; ++ i)
{
    if(IsPlayerAdmin(i) || pAdmin[i] > 0)
    {
         SendClienteMessa(i, -1, "Message to RCON Admin");
    }
}
Reply
#3

Is it for admins level above 1 also ?

EDIT:the errors
Код:
E:\**\ELC_AC.pwn(1366) : error 017: undefined symbol "pAdmin"
E:\**\ELC_AC.pwn(1366) warning 215: expression has no effect
E:\**\ELC_AC.pwn(1366) : error 001: expected token: ";", but found "]"
E:\**\ELC_AC.pwn(1366) : error 029: invalid expression, assumed zero
E:\**\ELC_AC.pwn(1366) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
   	for(new i; i < MAX_PLAYERS; ++ i)
	{
    	if(IsPlayerAdmin(i) || pAdmin[i] > 0) //1366
    	{
         SendClienteMessage(i, -1, "elc_str");
    	}
	}
Reply
#4

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
Is it for admins level above 1 also ?
Above 0.

@EDIT

This is a logic. Suits your system.
Reply
#5

please tell the code to define pAdmin in filterscript :c
Reply
#6

Show you Enum.
Reply
#7

Here you go:-
PHP код:
for(new iMAX_PLAYERS; ++ i)
    {
           if(
IsPlayerAdmin(i)) // it will send messages to rcon administrator!
              
{
                  
SendClientMessage(i, -1"elc_str");
              }
    } 
Reply
#8

Код:
enum aELCp
{
	elc_money,
	elc_ammo[13],
	elc_weapon[13],
	elc_tickfire,
	elc_ammoFire,
	elc_weaponFire,
	Float:elc_health,
	Float:elc_armour,
	elc_timer,
	Float:elc_posx,
	Float:elc_posy,
	Float:elc_posz,
	elc_interior,
	elc_virtualworld,
	Float:elc_AllowTelX,
	Float:elc_AllowTelY,
	Float:elc_AllowTelZ,
	elc_AntiTeleportHack,
	elc_AntiWeaponHack,
	elc_AntiAmmoBlockHack,
	elc_AntiMoneyHack,
	elc_AntiSpeedHack,
	elc_AntiHealthHack,
	elc_AntiArmourHack,
	elc_AntiVehicleTelportHack,
#if defined MODE_DELAY_SEND_STATS
	elc_GiveWeaponTime,
	elc_GiveMoneyTime,
	elc_GiveHealthTime,
	elc_GiveArmourTime,
#endif
	elc_SetPositionTime,
	elc_PlayerEnterTime,
	elc_PlayerEnterVeh,
	elc_PossibleVehicleHack,
	elc_LastUpdate,
	elc_TimeSpawn
};

new CheatPlayerInfo[MAX_PLAYERS][aELCp];
enum aELCv
{
	Float:elc_vHealth,
	Float:elc_vX,
	Float:elc_vY,
	Float:elc_vZ,
	Float:elc_vAngle,
	elc_vSetPositionTime,
	elc_vPossiblePlayerHack,
	elc_vPossibleHackTime,
	elc_vStatut
};
new CheatVehicleInfo[MAX_VEHICLES][aELCv];
#if defined NO_TICK_COUNT
enum aELCs
{
	elc_TickCount,
	elc_TimerTick
};
new CheatServerInfo[aELCs];
#endif
As i said its a filterscript and pAdmin is being used in the gamemode so ye we need to define pAdmin nagain in filterscript thats what im asking
EDIT:i need the cmd to be sent to all admin levels instead of rcon admin
Reply
#9

You can't do that. First you should copy everything from you Filterscript and put it in your Gamemode in the appropriate callbacks. Then only you can use pAdmin.
Reply
#10

Quote:
Originally Posted by DarkSkull
Посмотреть сообщение
You can't do that. First you should copy everything from you Filterscript and put it in your Gamemode in the appropriate callbacks. Then only you can use pAdmin.
That is what CallRemoteFunction is used for.

PHP код:
// in filterscript:
FS_SendMessageToAdmins(levelcolor, const string[])
{
    if (!
string[0]) return CallRemoteFunction("SendMessageToAdmins""iis"levelcolor"\1"); // passing "\1" if the string is empty to avoid the server crash
    
return CallRemoteFunction("SendMessageToAdmins""iis"levelcolorstring);
}
// in gamemode:
forward SendMessageToAdmins(levelcolor, const string[]);
public 
SendMessageToAdmins(levelcolor, const string[])
{
    if (
string[0] == '\1') return; // empty string was passed - do nothing
  
    
for (new 0GetPlayerPoolSize(); <= ji++)
    {
        if (!
IsPlayerConnected(i)) continue; 
        if (
/* VARIABLE HERE FOR ADMIN */ >= level)
        {
            
SendClientMessage(icolorstring);
        }
    }

Replace with the array you store the player's admin level and use "i" as index. Calling:
pawn Код:
FS_SendMessageToAdmins(3, -1, "Hi admins");
will call the public function from the gamemode and send the specified message in white to all the admins >= 3 level.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)