06.04.2013, 13:17
Hey there,
I've been busy scripting a new AntiCheat system for my server, but, for what ever reason it bans players even when they are not hacking. I've added it a bit for when a player registers, however, when that player spawns, it bans them.
Code:
It doesn't return any errors inside the script. Just as the player spawns.
I've been busy scripting a new AntiCheat system for my server, but, for what ever reason it bans players even when they are not hacking. I've added it a bit for when a player registers, however, when that player spawns, it bans them.
Code:
pawn Код:
UpdatePlayer(playerid)
{
// AntiCheat
if(!JustRegistered[playerid])
{
new RealMoney = GetPlayerCash(playerid), String[128], PlayerName[MAX_PLAYER_NAME];
if(GetPlayerMoney(playerid) != RealMoney)
{
ResetPlayerMoney(playerid);
GivePlayerCash(playerid, RealMoney);
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
format(String, sizeof(String), "AdmWarning: %s Is possibly hacking money - Cash Reset.", PlayerName);
SendClientMessageToAdmins(COLOR_AAC, String);
PlayerHacking[playerid]++;
}
new Float:health;
if(GetPlayerHealth(playerid, health) == 100.0)
{
if(PlayerInfo[playerid][pAdminLevel] == 0)
{
SetPlayerHealth(playerid, 99.9);
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
format(String, sizeof(String), "AdmWarning: %s Is possibly hacking health - Health Reset.", PlayerName);
SendClientMessageToAdmins(COLOR_AAC, String);
PlayerHacking[playerid]++;
}
return 1;
}
if(GetPlayerArmour(playerid, health) == 100.0)
{
if(PlayerInfo[playerid][pAdminLevel] == 0)
{
SetPlayerArmour(playerid, 99.9);
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
format(String, sizeof(String), "AdmWarning: %s Is possibly hacking armour - Armour Reset.", PlayerName);
SendClientMessageToAdmins(COLOR_AAC, String);
PlayerHacking[playerid]++;
}
return 1;
}
if(PlayerHacking[playerid] == 3 && PlayerInfo[playerid][pAdminLevel] == 0)
{
ResetPlayerMoney(playerid);
SetPlayerHealth(playerid, 0.0);
SetPlayerArmour(playerid, 0.0);
ResetPlayerWeapons(playerid);
BanPlayer(playerid, "General Cheats.", -1);
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK && PlayerInfo[playerid][pAdminLevel] == 2)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); // Reset the player.
format(String, sizeof(String), "AdmWarning: %s Is possibly jetpack hacking - Jetpack Reset.", PlayerName);
SendClientMessageToAdmins(COLOR_AAC, String);
PlayerHacking[playerid] ++;
PlayerUsingJetpack[playerid] = true;
}
if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN)
{
BanPlayer(playerid, "General Cheats.", -1);
}
SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
SetPlayerScore(playerid, GetPlayerScore(playerid) - PlayerInfo[playerid][pDeaths]);
OnPlayerSave(playerid);
OnPlayerPingUpdate(playerid);
PlayerSeconds[playerid]++;
if(PlayerSeconds[playerid] == 60)
{
PlayerMinutes[playerid]++;
PlayerSeconds[playerid] = 0;
}
if(PlayerMinutes[playerid] == 60)
{
PlayerHours[playerid]++;
PlayerSeconds[playerid] = 0;
}
return 1;
}
return 1;
}