01.05.2012, 13:37
I don't see what the problem with this code is, but a way to stop him from using it is to use the callback OnPlayerKeyStateChange
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
new string[128], Ip[16], gun_name[30], day, month, year, query[200];
if((newkeys & (KEY_FIRE) == KEY_FIRE) && (oldkeys & (KEY_FIRE) != KEY_FIRE)) {
if(GetPlayerWeapon(playerid) >= 1 && GetPlayerWeapon(playerid) <= 45) {
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerIp(playerid, Ip, sizeof(Ip));
GetWeaponName(GetPlayerWeapon(playerid), gun_name, sizeof(gun_name));
format(string, sizeof(string), "Admin-Log: %s has been banned for weapon hack (Wep:%s)(%s).", pname, gun_name, Ip);
SendAdminMessage(COLOR_RED, string);
getdate(year, month, day);
format(string, sizeof(string), "%02d/%02d/%d", day, month, year);
format(query, sizeof(query), "INSERT INTO `player_ban` (`name` ,`banned_by` ,`time` , `date` ,`reason` ,`ip`) VALUES ('%s', 'Steve', %i, '%s', 'WEAPON HACK: %s', '%s')", pname, gettime(), string, gun_name, Ip);
mysql_query(query);
SendClientMessage(i, COLOR_GREY, "You are banned from this server for 'weapon hacking'.");
TogglePlayerControllable(playerid,0);
Kick(playerid);
}
}
}