I am using that and for instance I've only had problems at the login screen, it once banned someone, why, I have no idea, but I made a check to see if the player is spawned and logged in, and I had no problems since that. YET, if it banned you in-game, then I don't know exactly what your problem might me, it may sound stupid but did you use "ServerWeapon" instead of "GivePlayerWeapon"? I made my own AntiCheat system(HP, speed, jetpack, money, etc.) without anyhelp, but to be honest, Ijust had no idea how to make the Anti Weapon-Hack, so this is interesting for me as well, anyway, make sure you used the right function.
|
I made a check to see if the player is spawned and logged in, and I had no problems since that.
|
new WeaponHacking[MAX_PLAYERS];
//Under OnPlayerUpdate
//Anti Weapon Hack
if(GetPlayerWeapon(playerid) == 1 || GetPlayerWeapon(playerid) == 2 || GetPlayerWeapon(playerid) == 5 || GetPlayerWeapon(playerid) == 6 || GetPlayerWeapon(playerid) == 7 || GetPlayerWeapon(playerid) == 8 || GetPlayerWeapon(playerid) == 10 || GetPlayerWeapon(playerid) == 11 || GetPlayerWeapon(playerid) == 12 || GetPlayerWeapon(playerid) == 13 ) //Put here the IDs of weapons you want, I'll post link after pawn.
{
if(PlayerInfo[playerid][pAdmin] < 10)
{
WeaponHacking[playerid] =1;
CheatsDetected(playerid);
return 1;
}
}
if(GetPlayerWeapon(playerid) == 14 || GetPlayerWeapon(playerid) == 15 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 35 || GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 41 || GetPlayerWeapon(playerid) == 42 || GetPlayerWeapon(playerid) == 43 || GetPlayerWeapon(playerid) == 44 || GetPlayerWeapon(playerid) == 45)
{
if(PlayerInfo[playerid][pAdmin] < 10)
{
WeaponHacking[playerid] =1;
CheatsDetected(playerid);
return 1;
}
}
//OTHER CODES
//Now lets go to the stock CheatsDetected
//Stock CheatsDeteceed
stock CheatsDetected(playerid)
{
new string[128];
if(WeaponHacking[playerid] == 1)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof(string),"[ANTI CHEAT] Anti-Cheat has banned %s(%d). [Reason: Cheats Detected]",pName,playerid);
SendClientMessageToAll(COLOR_PINK,string);
format(string,sizeof(string),"1[ANTI CHEAT] Anti-Cheat has banned %s(%d). [Reason: Cheats Detected]",pName,playerid);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
IRC_GroupSay(gGroupID,IRC_ADMINCHANNEL,string);
format(string, sizeof(string), "~r~BANNED!");
GameTextForPlayer(playerid, string, 3000, 1);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Player's Data");
INI_WriteString(File,"BanReason","Cheats Detected");
INI_WriteString(File,"Reason","Weapon Hacks");
INI_Close(File);
PlayerInfo[playerid][pBanned] =1;
SetTimerEx("KickPlayer",1000,false,"i",playerid);
return 1;
}
return 1;
}
//In o.3x Kick(playerid); has proirity over all codes, so you have to make a timer for it
//like this so it posts all the codes needed before the kick
forward KickPlayer(ID);
public KickPlayer(ID)
{
Kick(ID);
return 1;
}
//Now lets come to OnPlayerConnect part
//So I'm using Y_INI as you see
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(PlayerInfo[playerid][pBanned] == 1)
{
format(string,sizeof(string),"[BANNED] You are currently banned from the server. [Reason: %s]",PlayerInfo[playerid][pBanReason]);
SendClientMessage(playerid, COLOR_RED,string);
SendClientMessage(playerid, COLOR_RED,"[BANNED] Please Ban Appeal on our forums at www.SERVER.net");
SetTimerEx("KickPlayer",1000,false,"i",playerid);
return 1;
}
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{FF0000}SERVER","{FFFFFF}Welcome back to the server! \n Type your password below to login.","Login","Quit");
}