SA-MP Forums Archive
AntiFake Kill HELP !!!! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: AntiFake Kill HELP !!!! (/showthread.php?tid=581480)



AntiFake Kill HELP !!!! (SOLVED) - NexySamp - 13.07.2015

Okay,so today a guy entered my server with the nickname "Viking" ,he had a fakekill hack that gave everyone on my server a wanted level.I baned him,but how can i prevent this from happening again.Can anyone make me a really simple code so i can add it to my GM. P.S dont want FS-s.Tnx in advance


Re: AntiFake Kill HELP !!!! - arlindi - 13.07.2015

Use IsPlayerInRangeOfPoint
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: AntiFake Kill HELP !!!! - NexySamp - 13.07.2015

Can you make me a code,i dont know what to do :/


Re: AntiFake Kill HELP !!!! - NexySamp - 13.07.2015

This works
PHP код:
// Anti FakeKill Flood by RuNix
#include <a_samp>
new XDeaths[MAX_PLAYERS];
new 
LastDeath[MAX_PLAYERS];
public 
OnFilterScriptInit()
{
    print(
"\n----------------------------------------");
    print(
" Anti FakeKill Flood FilterScript by RuNix");
    print(
"----------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
XDeaths[playerid] = 0;
    
LastDeath[playerid] = 0;
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(
XDeaths[playerid] == 0)
    {
       
LastDeath[playerid] = gettime();
    }
    
XDeaths[playerid]++;
    if(
XDeaths[playerid] == 5)
    {
        if((
gettime() - LastDeath[playerid]) <= 5)
        {
            
SendClientMessage(playerid,0,"{FFBF00}Hey n0b, flood your mother!");
            
BanEx(playerid,"Banned for FakeKill Flood");
        }else
        if((
gettime() - LastDeath[playerid]) > 5)
        {
            
XDeaths[playerid]=0;
        }
    }
    return 
1;




Re: AntiFake Kill HELP !!!! - M4D - 13.07.2015

you can check time between deaths with "GetTickCount()"
but for more accuracy:
if i kill someone, i have to give damage to him/her !
so make a variable and check player has received any damage or no
i'll give you a simple example (explained in code with comments)

Код:
new bool:PlayerShotedPlayer[MAX_PLAYERS][MAX_PLAYERS]; //> (PlayerShotedPlayer[killer][player])

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
	if(issuerid != INVALID_PLAYER_ID && playerid != INVALID_PLAYER_ID)
	{
		PlayerShotedPlayer[issuerid][playerid] = true; //>issuerid gave damage to player id, so set variable true
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(killerid != INVALID_PLAYER_ID)
	{
		if(PlayerShotedPlayer[killerid][playerid] == false)
		{
			//Kick or ban playerid (cheater) Here
		}
	}
	//if playerid wasn't cheater so .. let's reset damage variable
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		PlayerShotedPlayer[i][playerid] = false;
	}
	return 1;
}
i wrote code completely, you can copy&paste it into your gamemode (add kick or ban code)
but please read code and learn
Down With Cheaters
Good Luck


Re: AntiFake Kill HELP !!!! - Evocator - 13.07.2015

Quote:
Originally Posted by M4D
Посмотреть сообщение
you can check time between deaths with "GetTickCount()"
but for more accuracy:
if i kill someone, i have to give damage to him/her !
so make a variable and check player has received any damage or no
i'll give you a simple example (explained in code with comments)

Код:
new bool:PlayerShotedPlayer[MAX_PLAYERS][MAX_PLAYERS]; //> (PlayerShotedPlayer[killer][player])

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
	if(issuerid != INVALID_PLAYER_ID && playerid != INVALID_PLAYER_ID)
	{
		PlayerShotedPlayer[issuerid][playerid] = true; //>issuerid gave damage to player id, so set variable true
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(killerid != INVALID_PLAYER_ID)
	{
		if(PlayerShotedPlayer[killerid][playerid] == false)
		{
			//Kick or ban playerid (cheater) Here
		}
	}
	//if playerid wasn't cheater so .. let's reset damage variable
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		PlayerShotedPlayer[i][playerid] = false;
	}
	return 1;
}
i wrote code completely, you can copy&paste it into your gamemode (add kick or ban code)
but please read code and learn
Down With Cheaters
Good Luck
I suggest you only reject the hit, and if its fast enough. Kick them. A player might kill another one without giving damage due to lag - heliblading, car ramming at < 5 HP