If player cheat, send msg only to admins to check
#1

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

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;
}
Reply
#3

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

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

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

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

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!
Reply
#8

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)