SA-MP Forums Archive
Help with AntiCheat - 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: Help with AntiCheat (/showthread.php?tid=524635)



Help with AntiCheat - skydux123 - 07.07.2014

Hello again, now I have another problem. I tried to create an AntiCheat system. No errors, but when i connect to the server I been kicked for health cheat... Can anyone help me?
Код:
forward AntiCheat(playerid);
public AntiCheat(playerid)
{
	new Float:HP;
	GetPlayerHealth(playerid, HP);
	if(HP > 99) //Anti Gyvybių cheat
	{
	    SetPlayerHealth(playerid, 40);
	    Saugojimas(playerid);
		ISZ(playerid, "{FF0000}[SERVER]: You have been kicked for HEALTH CHEAT");
		new zin[150];
		format(zin, sizeof(zin), "{FF0000}[SERVER]: %s was kicked for HEALTH CHEAT!", GetPlayerNameEx(playerid));
		SendClientMessageToAll(-1, zin);
	}
	new Float:Arm;
	GetPlayerArmour(playerid, Arm);
	if(Arm > 99) //Anti Gyvybių cheat
	{
	    SetPlayerArmour(playerid, 0);
	    Saugojimas(playerid);
		ISZ(playerid, "{FF0000}[SERVER]: You have been kicked for armour cheat");
		new zin[150];
		format(zin, sizeof(zin), "{FF0000}[SERVER]: %s was kicked for ARMOUR CHEAT!", GetPlayerNameEx(playerid));
		SendClientMessageToAll(-1, zin);
	}
	return 1;
}



Re: Help with AntiCheat - iOxide - 07.07.2014

Its because, in your anti cheat you have checked if the player health is higher than 99 then kick the player and when you spawn you get exactly 100 health which is higher than 99 health by 1.


Re: Help with AntiCheat - nmader - 07.07.2014

Basically start your anti-cheat function for after the player spawns.


Re: Help with AntiCheat - skydux123 - 07.07.2014

Quote:
Originally Posted by nmader
Посмотреть сообщение
Basically start your anti-cheat function for after the player spawns.
I call anti cheat when player's info loads. Player is spawned when.


Re: Help with AntiCheat - skydux123 - 07.07.2014

I call anticheat here
Код:
stock Load(playerid)
{
	new
		Float:Pos[3], // 0,1,2 - pos;
		fetch[16],
	    Query[256];

    format(Query, sizeof(Query), "SELECT * FROM `users` WHERE Name= '%s'", GetPlayerNameEx(playerid));
    mysql_query(Query);
	mysql_store_result( );
	mysql_retrieve_row( );


	mysql_fetch_field_row( fetch, "X" );
	Pos[0] = floatstr(fetch);
	mysql_fetch_field_row( fetch, "Y" );
	Pos[1] = floatstr(fetch);
	mysql_fetch_field_row( fetch, "Z" );
	Pos[2] = floatstr(fetch);

	SetPlayerPos( playerid, Pos[0], Pos[1], Pos[2] + 0.75);
	
	mysql_fetch_field_row( fetch, "Health" );
	SetPlayerHealth(playerid, floatstr(fetch));
	mysql_fetch_field_row( fetch, "Armour" );
	SetPlayerArmour(playerid, floatstr(fetch));
	
	SetTimerEx("AntiCheat", 1000, true, "i", playerid);
}



Re: Help with AntiCheat - MehranGta - 07.07.2014

use timers cuz timers are better than opu.
after that check your script that it doesn't set any %100 health.


Re: Help with AntiCheat - skydux123 - 07.07.2014

Quote:
Originally Posted by MehranGta
Посмотреть сообщение
use timers cuz timers are better than opu.
after that check your script that it doesn't set any %100 health.
I set timer...
Код:
SetTimerEx("AntiCheat", 1000, true, "i", playerid);