SA-MP Forums Archive
Anti Health/Armour Hack. - 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: Anti Health/Armour Hack. (/showthread.php?tid=465104)



Anti Health/Armour Hack. - AfikAtashga - 20.09.2013

Hello everyone,
I started to make an AntiCheat for my gamemode,
The AntiCheat works fine, but when players shoot player, or player jump from an hige place, the script see it like an cheat.

I think to use OnPlayerGiveDamage (tell me if it incorrect)
I dont understand how to check if the amount of damage is Health or an Armour, And how to do it.

my functions is:
Код:
CDM_SetPlayerHealth(playerid, Float:health);
CDM_SetPlayerArmour(playerid, Float:armour);
HELP & Sry about my English.

edit:

I did something like:
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
	new Float:p[2];
	GetPlayerHealth(damagedid, p[0]);
	GetPlayerArmour(damagedid, p[1]);
	if(p[1] != 0) CDM_SetPlayerArmour(damagedid, p[1]-amount);
	else if(!p[1]) CDM_SetPlayerHealth(damagedid, p[0]-amount);
    return 1;
}
But it's isn't work.


Re: Anti Health/Armour Hack. - AfikAtashga - 21.09.2013

UP..


Re: Anti Health/Armour Hack. - AfikAtashga - 22.09.2013

UP..


Re: Anti Health/Armour Hack. - jueix - 22.09.2013

Can you show us the anticheat code, For example, The code to detect wether or not the player is hacking?


Re: Anti Health/Armour Hack. - AfikAtashga - 29.09.2013

Quote:
Originally Posted by jueix
Посмотреть сообщение
Can you show us the anticheat code, For example, The code to detect wether or not the player is hacking?
OnPlayerUpdate:
Код:
		new Float:health, Float:armour;
		GetPlayerHealth(playerid, health);
		GetPlayerArmour(playerid, armour);
		if(health != GetPVarFloat(playerid, "Health"))
		{
			SetPlayerHealth(playerid, GetPVarFloat(playerid, "Health"));
		}
		if(armour != GetPVarFloat(playerid, "Armour"))
		{
			SetPlayerArmour(playerid, GetPVarFloat(playerid, "Armour"));
		}
Function:
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
	new Float:p[2];
	CDM_GetPlayerHealth(issuerid, p[0]);
	CDM_GetPlayerArmour(issuerid, p[1]);
	if(p[1] != 0) CDM_SetPlayerArmour(issuerid, p[1]-amount);
	else if(!p[1]) CDM_SetPlayerHealth(issuerid, p[0]-amount);

	if(amount != 0 && p[0] == 100.0)
	{
		for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && player[i][adminlevel] != 0)
		{
		    message[0] = EOS;
			SendFormatMessageToAll(color_red, message, "(AC) {FFFFFF}%s {FF0000}has using hacks (reason: Godmode Hack)", getname[issuerid]);
		}
	}
    return 1;
}
I dont think that's the right public.
HELP.


Re: Anti Health/Armour Hack. - AfikAtashga - 30.09.2013

-_- UP PLEASE!