//anti fake kill
new antifakekill[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
antifakekill[playerid] ++;
SetTimerEx("antifakekill2", 1000,false,"i",playerid);
return 1;
}
forward antifakekill2(playerid);
public antifakekill2(playerid)
{
antifakekill[playerid] --;
if(antifakekill[playerid] > 3)
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"* %s was banned reason (Fake kill)",pName);
SendClientMessageToAll(0xFF0000FF,string);
BanEx(playerid, "Fake kill");
}
return 1;
}
if(killerid != INVALID_PLAYER_ID && playerid == killerid)
{
return Kick(playerid);
}
if(GetPVarInt(playerid, "last_died_at") > GetTickCount())
{
Kick(playerid);
return 1;
}
SetPVarInt(playerid, "last_died_at", GetTickCount()+500);
|
Код:
if(killerid != INVALID_PLAYER_ID && playerid == killerid)
{
return Kick(playerid);
}
if(GetPVarInt(playerid, "last_died_at") > GetTickCount())
{
Kick(playerid);
return 1;
}
SetPVarInt(playerid, "last_died_at", GetTickCount()+500);
|
|
I think you are trying to ban all players that have a hack that kills themself with
But the code you wrote will ban all players that died more than 3 times If the killer kills the player 3 times the player will get banned, Even though they didn't hack That also applies for people that commited suicide |
|
This will cause only people that commit suicide to get kicked, Look closely
If the killer is the player, kick the player, which if someone fall from a high place, will get kicked, because he killed himself, Think a bit before u script |
|
I currently use this thing in my server there is no wrong fake-kill.
|
|
[..] distance between the "killer" & the victim (who is the one hacking) [..]
|
|
Distance won't work. For example when you give damage somebody and he types /kill. The system will kick wrong person.
|
|
The use of a timer is unnecessary, you can still increase the variable in the callback. I'd also advise to stop the execution right there if the value of the variable is over 3 as we wouldn't want to add the "fake kills" to the players' statistics and execute pointless code.
|
|
Simply check whether the player has registered damage to the other player or not. If the player did not, then cheat confirmed.
That is as simple as it gets, consider other factors if you want a more effective anti-system (though the above would serve you fine) |