SA-MP Forums Archive
[Help]How can i Change SendClientMessageToAll to 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: [Help]How can i Change SendClientMessageToAll to SendAdminMessage (/showthread.php?tid=622673)



[Help]How can i Change SendClientMessageToAll to SendAdminMessage - Simon007 - 25.11.2016

Код:
#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
//*Can You Help Me !!!*//


Re: [Help]How can i Change SendClientMessageToAll to SendAdminMessage - SyS - 25.11.2016

Код:
#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);
    
   
    for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
         if(IsPlayerAdmin(i))
              SendClientMessage(i,0xBD0000FF,elc_str);	
    return 1;
}
#endif
You can wrap it into a function if you want to use it
Код:
SendAdminMessage(string[])
{

for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
     if(IsPlayerAdmin(i))
          SendClientMessage(i,0xBD0000FF,string);

return 1;
}
and call it like this:
Код:
SendAdminMessage(elc_str);//SendAdminMessage(char*)



Re: [Help]How can i Change SendClientMessageToAll to SendAdminMessage - Simon007 - 25.11.2016

Код:
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1369) : warning 217: loose indentation
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1372) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase



Re: [Help]How can i Change SendClientMessageToAll to SendAdminMessage - SyS - 25.11.2016

Quote:
Originally Posted by Simon007
Посмотреть сообщение
Код:
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1369) : warning 217: loose indentation
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1372) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Sorry for bad indentation as the forum sucks in writing indented code (i tried to edited though)
You can fix the indentation by putting tabs and by making the code readable.


Re: [Help]How can i Change SendClientMessageToAll to SendAdminMessage - Simon007 - 25.11.2016

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Sorry for bad indentation as the forum sucks in writing indented code (i tried to edited though)
You can fix the indentation by putting tabs and by making the code readable.
Now No one Can See the Msg


Re: [Help]How can i Change SendClientMessageToAll to SendAdminMessage - SyS - 25.11.2016

Quote:
Originally Posted by Simon007
Посмотреть сообщение
Now No one Can See the Msg
You should login as rcon to see the message.


Re: [Help]How can i Change SendClientMessageToAll to 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.


Re: [Help]How can i Change SendClientMessageToAll to SendAdminMessage - Simon007 - 25.11.2016

Quote:
Originally Posted by iamjems
Посмотреть сообщение
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.
Код:
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1744) : error 017: undefined symbol "foreach"
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1746) : error 017: undefined symbol "i"
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1748) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Errors :/


Re: [Help]How can i Change SendClientMessageToAll to SendAdminMessage - Simon007 - 26.11.2016

Quote:
Originally Posted by iamjems
Посмотреть сообщение
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.
Код:
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1744) : error 017: undefined symbol "foreach"
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1746) : error 017: undefined symbol "i"
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1748) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Errors :/


Re: [Help]How can i Change SendClientMessageToAll to SendAdminMessage - DetoNater - 26.11.2016

Quote:
Originally Posted by Simon007
Посмотреть сообщение
Код:
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1744) : error 017: undefined symbol "foreach"
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1746) : error 017: undefined symbol "i"
C:\Users\user\Desktop\ELC_ANTI-CHEAT(V4.4)\filterscripts\ELC_AC.pwn(1748) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Errors :/
you should have a foreach include Get it here and just put it in your script after #include<a_samp>