17.04.2017, 15:45
pawn Код:
if(Taser[playerid] == 0 && WepAmmo[weapon] == 0 && weapon == 0 && PaintballGun[playerid] == 0 && PlayerUsingTempWep[playerid] == 0 && UsingMolotov[playerid] == 0 && weaponid != 46 && weaponid != WepModel[model])//&& weaponid != 46 && (UsingMolotov[playerid] == 0 && GetWeaponSlot(playerid) == 8)
{
ResetPlayerWeapons(playerid);
new playerip[24], query[256];
format(string, sizeof(string), "[Auto-Ban] %s has been banned by the server for weapon hacking.", GetNameEx(playerid));
SendClientMessageToAll(COLOUR_REALRED, string);
GetPlayerIp(playerid, playerip, sizeof(playerip));
MySQL_SetInteger(PlayerSQLID[playerid], "Banned" , 1, "accounts");
format(string,sizeof(string), "Your IP: {FF0000}%s {FFFFFF}has been{FF0000} BANNED{FFFFFF} from Bone County Roleplay.", playerip);
SendClientMessage(playerid, COLOUR_WHITE, string);
format(string, sizeof(string),"Reason: {FF0000}Suspected Weapon Hacks.");
SendClientMessage(playerid, COLOUR_WHITE, string);
SendClientMessage(playerid, COLOUR_REALRED, "{FFFFFF}PLEASE POST A {FF0000}BAN APPEAL {FFFFFF}AT http://forum.bonecountyrp.com");
GetPlayerIp(playerid, playerip, sizeof(playerip));
format(query, sizeof(query), "SELECT * FROM `bans` WHERE `ip` = '%s'", playerip);
mysql_tquery(dbHandle, query, "IsPlayerAlreadyBanned", "i", playerid);
SavePlayerData(playerid);
RemovePlayerVehicles(playerid);
ClearPlayerID(playerid);
}
This is a must as it isn't always detected when changing weapons, but it sadly spams the database if it is like a mini-gun or something.
IsPlayerAlreadyBanned is supposed to check, but there is a 0.2 second kick timer, perhaps the cause?
pawn Код:
forward IsPlayerAlreadyBanned(playerid);
public IsPlayerAlreadyBanned(playerid)
{
new rows, fields;
cache_get_data(rows, fields);
new pip[64];
GetPlayerIp(playerid, pip, sizeof(pip));
if(rows)
{
SetTimerEx("KickPlayer", 200, false, "i",playerid);// Kicks player in 500ms
}
else
{
switch(BanReason[playerid])
{
case 0:
{
new query[256];
format(query, sizeof(query), "INSERT INTO `bans` (playername, ip, Reason, Date, BanBy) VALUES ('%s', '%s', 'Weapon Hacking', %d, 0)", GetName(playerid), pip, gettime());
mysql_tquery(dbHandle, query, "", "");
SetTimerEx("KickPlayer", 200,false,"i",playerid);
}
case 1:
{
new query[256];
format(query, sizeof(query), "INSERT INTO `bans` (playername, ip, Reason, Date, BanBy) VALUES ('%s', '%s', 'Vehicle Teleporting', %d, 0)", GetName(playerid), pip, gettime());
mysql_tquery(dbHandle, query, "", "");
SetTimerEx("KickPlayer", 200,false,"i",playerid);
}
case 2:
{
new query[256];
format(query, sizeof(query), "INSERT INTO `bans` (playername, ip, Reason, Date, BanBy) VALUES ('%s', '%s', 'Fly Hacking', %d, 0)", GetName(playerid), pip, gettime());
mysql_tquery(dbHandle, query, "", "");
SetTimerEx("KickPlayer", 200,false,"i",playerid);
}
default:
{
new query[256];
format(query, sizeof(query), "INSERT INTO `bans` (playername, ip, Reason, Date, BanBy) VALUES ('%s', '%s', 'Weapon Hacking', %d, 0)", GetName(playerid), pip, gettime());
mysql_tquery(dbHandle, query, "", "");
SetTimerEx("KickPlayer", 200,false,"i",playerid);
}
}
}
return 1;
}