SA-MP Forums Archive
If player cheat, send msg only to admins to check - 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: If player cheat, send msg only to admins to check (/showthread.php?tid=517374)



If player cheat, send msg only to admins to check - ghostomgg - 04.06.2014

Hi, i am a newbie, and i am editing some scripts. I edited Anti-Cheat, and i want the public "OnPlayerCheat" to make to send only to pAdmins. I added to the script PlayerInfo + pAdmin in the enum.
Now i want these:
Код:
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),"{F83F3F}MGIG: {C3C3C3}%s mozhebi koristi: ",elc_name);
    switch(cheatid)
    {
        case 1: format(elc_reason,sizeof(elc_reason),"Money Hack( %s $ )",source);
        case 2: format(elc_reason,sizeof(elc_reason),"Weapon Hack ( %s )",source);
        case 3: format(elc_reason,sizeof(elc_reason),"Ammo Hack ( %s kurshumi )",source);
        case 4: format(elc_reason,sizeof(elc_reason),"Ammo Block Hack");
        case 5: format(elc_reason,sizeof(elc_reason),"Speed Hack");
        case 6: format(elc_reason,sizeof(elc_reason),"****** Hack");
        case 7: format(elc_reason,sizeof(elc_reason),"Health/Krv Hack");
        case 8: format(elc_reason,sizeof(elc_reason),"Armor/Pancir Hack");
        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;
}
To send only to admins.
With this code, i can see when player cheats ( MGIG: %s maybe uses ex. Ammo Hack ) and i /recon him // /specplayer him.
Help me.


Re: If player cheat, send msg only to admins to check - Jay_Dixon - 04.06.2014

Try replacing the SendClientMessageToAll with

Код:
forward ABroadCast(color,const string[],level);
Код:
public ABroadCast(color,const string[],level) {
    //FuncLog("ABroadCast");
	foreach(Player,i) {
   		if (playerInfo[i][pAdmin] >= level) {
			SendClientMessage(i, color, string);
		}
	}
	print(string);
	return 1;
}



Re: If player cheat, send msg only to admins to check - Koala818 - 04.06.2014

pawn Код:
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),"{F83F3F}MGIG: {C3C3C3}%s mozhebi koristi: ",elc_name);
    switch(cheatid)
    {
        case 1: format(elc_reason,sizeof(elc_reason),"Money Hack( %s $ )",source);
        case 2: format(elc_reason,sizeof(elc_reason),"Weapon Hack ( %s )",source);
        case 3: format(elc_reason,sizeof(elc_reason),"Ammo Hack ( %s kurshumi )",source);
        case 4: format(elc_reason,sizeof(elc_reason),"Ammo Block Hack");
        case 5: format(elc_reason,sizeof(elc_reason),"Speed Hack");
        case 6: format(elc_reason,sizeof(elc_reason),"****** Hack");
        case 7: format(elc_reason,sizeof(elc_reason),"Health/Krv Hack");
        case 8: format(elc_reason,sizeof(elc_reason),"Armor/Pancir Hack");
        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);
foreach(Player, i)
{
    if(IsPlayerAdmin(i)) //If the player is logged as rcon admin
    {
         SendClientMessage(i, 0xBD0000FF, elc_str); //Send the message to him
    }
}
    return 1;
}
I hope you get it.


Re: If player cheat, send msg only to admins to check - ghostomgg - 04.06.2014

Quote:
Originally Posted by Jay_Dixon
Посмотреть сообщение
Try replacing the SendClientMessageToAll with

Код:
forward ABroadCast(color,const string[],level);
Код:
public ABroadCast(color,const string[],level) {
    //FuncLog("ABroadCast");
	foreach(Player,i) {
   		if (playerInfo[i][pAdmin] >= level) {
			SendClientMessage(i, color, string);
		}
	}
	print(string);
	return 1;
}
: error 017: undefined symbol "foreach"
: error 017: undefined symbol "i"
: error 017: undefined symbol "i"


Re: If player cheat, send msg only to admins to check - ghostomgg - 04.06.2014

Quote:
Originally Posted by Koala818
Посмотреть сообщение
pawn Код:
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),"{F83F3F}MGIG: {C3C3C3}%s mozhebi koristi: ",elc_name);
    switch(cheatid)
    {
        case 1: format(elc_reason,sizeof(elc_reason),"Money Hack( %s $ )",source);
        case 2: format(elc_reason,sizeof(elc_reason),"Weapon Hack ( %s )",source);
        case 3: format(elc_reason,sizeof(elc_reason),"Ammo Hack ( %s kurshumi )",source);
        case 4: format(elc_reason,sizeof(elc_reason),"Ammo Block Hack");
        case 5: format(elc_reason,sizeof(elc_reason),"Speed Hack");
        case 6: format(elc_reason,sizeof(elc_reason),"****** Hack");
        case 7: format(elc_reason,sizeof(elc_reason),"Health/Krv Hack");
        case 8: format(elc_reason,sizeof(elc_reason),"Armor/Pancir Hack");
        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);
foreach(Player, i)
{
    if(IsPlayerAdmin(i)) //If the player is logged as rcon admin
    {
         SendClientMessage(i, 0xBD0000FF, elc_str); //Send the message to him
    }
}
    return 1;
}
I hope you get it.
Same errors, with the last reply.


Re: If player cheat, send msg only to admins to check - DavidBilla - 04.06.2014

Download the include called foreach and add it to your pawno include folder,after that at top of the script,add the line
#include <foreach>


Re: If player cheat, send msg only to admins to check - ghostomgg - 04.06.2014

Quote:
Originally Posted by DavidBilla
Посмотреть сообщение
Download the include called foreach and add it to your pawno include folder,after that at top of the script,add the line
#include <foreach>
Thanks!


Re: If player cheat, send msg only to admins to check - ghostomgg - 04.06.2014

http://imgur.com/YQAO7yy
Look at the pic.
Код:
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),"{F83F3F}MGIG: {C3C3C3}%s mozhebi koristi: ",elc_name);
    switch(cheatid)
    {
        case 1: format(elc_reason,sizeof(elc_reason),"Money Hack( %s $ )",source);
        case 2: format(elc_reason,sizeof(elc_reason),"Weapon Hack ( %s )",source);
        case 3: format(elc_reason,sizeof(elc_reason),"Ammo Hack ( %s kurshumi )",source);
        case 4: format(elc_reason,sizeof(elc_reason),"Ammo Block Hack");
        case 5: format(elc_reason,sizeof(elc_reason),"Speed Hack");
        case 6: format(elc_reason,sizeof(elc_reason),"****** Hack");
        case 7: format(elc_reason,sizeof(elc_reason),"Health/Krv Hack");
        case 8: format(elc_reason,sizeof(elc_reason),"Armor/Pancir Hack");
        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);
foreach(Player, i)
{
    if(PlayerInfo[i][pAdmin] >= 1) //If the player is logged as rcon admin
    {
         SendClientMessage(i, 0xBD0000FF, elc_str); //Send the message to him
    }
}
    return 1;
}