public OnPlayerDeath(playerid, killerid, reason)
{
if(GetTickCount() - LastDeath[playerid] < 1000)
{
DeathCount[playerid]++;
}
if(DeathCount[playerid] >=3)
Kick(playerid); // anti fake-kill
LastDeath[playerid]=GetTickCount();
}
public OnPlayerDeath(playerid, killerid, reason)
{
DeathCount[playerid]++;
if(DeathCount[playerid] > 3 && GetTickCount() - LastDeath[playerid] < 1000)
{
//fake killing
}
if(GetTickCount() - LastDeath[playerid] > 1000)
{
DeathCount[playerid] = 0; // reset death count to avoid wrongful bans
}
LastDeath[playerid]=GetTickCount();
}
if(killerid != INVALID_PLAYER_ID)
{
SendDeathMessage(killerid, playerid, reason);
new time = gettime( );
switch( time - LastDeath[ playerid ] )
{
case 0 .. 3:
{
DeathSpam{ playerid }++;
if( DeathSpam{ playerid } == 3)
{
printf("[System: Fake Kill] - %s(%d) Has Fake Killed %s(%d)", Playername(playerid), playerid, Playername(killerid), killerid);
MessageToAdmins(COLOR_ADMIN, "[System: Fake Kill] - %s(%d) Has Fake Killed %s(%d)", Playername(playerid), playerid, Playername(killerid), killerid);
format(GlobalString, sizeof(GlobalString), "10[System: Fake Kill] - %s(%d) Has Fake Killed %s(%d)", Playername(playerid), playerid, Playername(killerid), killerid);
IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, GlobalString);
format(GlobalString, sizeof(GlobalString), "SERVER BAN: %s(%d) Has Been Banned From The Server - Reason: Fake Killing.", Playername(playerid), playerid);
SendClientMessageToAll(PINK, GlobalString);
IRC_GroupSay(gGroupID, ECHO_IRC_CHANNEL, GlobalString);
IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, GlobalString);
SendClientMessage(playerid, LIGHTBLUE, "You Have Been Banned For Attempting To Fake Kill Users");
SafeBan(playerid, "Fake Killing", 12);
return 1;
}
}
default: DeathSpam{ playerid } = 0;
}
LastDeath[ playerid ] = time;
//ANTI FAKE DEATH
if((GetTickCount() - GetPVarInt(killerid, "deathtime")) < 220)
{
SetPVarInt(killerid, "killspam", GetPVarInt(killerid, "killspam") + 1);
if(GetPVarInt(killerid, "killspam") >= 5)
{
printf("[System: Fake Deaths] - %s(%d)", Playername(killerid), killerid);
MessageToAdmins(COLOR_ADMIN, "[System: Fake Deaths] - %s(%d)", Playername(killerid), killerid);
format(GlobalString, sizeof(GlobalString), "10[System: Fake Deaths] - %s(%d)", Playername(killerid), killerid);
IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, GlobalString);
format(GlobalString, sizeof(GlobalString), "SERVER BAN: %s(%d) Has Been Banned From The Server - Reason: Fake Deaths.", Playername(killerid), killerid);
SendClientMessageToAll(PINK, GlobalString);
IRC_GroupSay(gGroupID, ECHO_IRC_CHANNEL, GlobalString);
IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, GlobalString);
SendClientMessage(killerid, LIGHTBLUE, "You Have Been Banned For Attempting To Fake Death Yourself");
SafeBan(killerid, "Fake Deaths", 12);
Kick(killerid);
return 1;
}
}
SetPVarInt(killerid, "deathtime", GetTickCount());
The method you used to detect fake kills detects it at minimum after 3 seconds.
pawn Код:
|