PDA

View Full Version : If player cheat, send msg only to admins to check


ghostomgg
04/06/2014, 05:30 PM
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.

Jay_Dixon
04/06/2014, 05:35 PM
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;
}

Koala818
04/06/2014, 05:38 PM
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.

ghostomgg
04/06/2014, 05:38 PM
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"

ghostomgg
04/06/2014, 05:40 PM
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.

DavidBilla
04/06/2014, 05:49 PM
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>

ghostomgg
04/06/2014, 07:41 PM
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!

ghostomgg
04/06/2014, 08:00 PM
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;
}