SA-MP Forums Archive
SendAdminMessage - 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: SendAdminMessage (/showthread.php?tid=622677)



SendAdminMessage - Simon007 - 25.11.2016

How Can i change SendClientMessageToAll To SendAdminMessage, i wanna make admins the Only Ones Who Can See it

Код:
/*----------------------------------------------------------------------------*/
#define EnablePlayerCheatID ELC_AC_EnablePlayerCheatID
/*----------------------------------------------------------------------------*/
#if defined INCLUDE_BASE_MODE
#else
public OnPlayerCheat(playerid, cheatid, source[])
{
    new elc_str[120],elc_reason[60],elc_name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, elc_name, sizeof(elc_name));
    format(elc_str,sizeof(elc_str),"( ! ) %s (Maybe)has been cheated for: ",elc_name);
    switch(cheatid)
    {
        case 1: format(elc_reason,sizeof(elc_reason),"Money Cheat ( %s $ )",source);
        case 2: format(elc_reason,sizeof(elc_reason),"Weapon Cheat ( %s )",source);
        case 3: format(elc_reason,sizeof(elc_reason),"Ammo Cheat ( %s Bullets )",source);
        case 4: format(elc_reason,sizeof(elc_reason),"Ammo Block Cheat");
        case 5: format(elc_reason,sizeof(elc_reason),"Speed Cheat");
        case 6: format(elc_reason,sizeof(elc_reason),"Airbreak/Teleport Cheat");
        case 7: format(elc_reason,sizeof(elc_reason),"Health Cheat");
        case 8: format(elc_reason,sizeof(elc_reason),"Armour Cheat");
        case 9: format(elc_reason,sizeof(elc_reason),"Vehicle Spawn Cheat");
        case 10: format(elc_reason,sizeof(elc_reason),"Vehicle Crasher");
    }
    strcat(elc_str,elc_reason);
    SendClientMessageToAll(0xBD0000FF,elc_str);
	return 1;
}
#endif



Re: SendAdminMessage - mongi - 25.11.2016

PHP код:
    for(new i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
/*Your code to check if the player is admin*/)
            {
                
SendClientMessage(i0xBD0000FFelc_str);
            }
        }
    } 
Easy and simple way.


Re: SendAdminMessage - iamjems - 25.11.2016

Add this somewhere in your script, it doesn't really matter.

PHP код:
stock SendAdminMessage(colorstring[], level)
{
    foreach(
Playeri)
    {
        if(
PlayerInfo[i][pAdmin] >= level// change this to your admin variable
        
{
            
SendClientMessage(icolorstring);
        }
    }

Now you can use it anywhere you would like to:

PHP код:
SendAdminMessage(0x00FFFFFF"Hello!"1); 
"Hello!" will now show up for level 1 or higher admins.