[FilterScript] Anti-Aimbot by ipsLeon
#19

Quote:
Originally Posted by JonathanFeitosa
View Post
Parabйns, bom trabalho. Deveria tentar(de novo) fazer para aqueles de mira fixa.
Obrigado, preciso re-ver o conceito do cуdigo e melhorar o algorнtimo pra detecзгo, a ъltima vez que mexi no anti-aimlock nгo obtive bons resultados, mas em breve estarei re-fazendo, cуdigo antigo:

Code:
#define WEAPON_MODE_RELEASE 0
#define WEAPON_MODE_HOLD 1
#define WEAPON_MODE_AIM	2

#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

#define RELEASED(%0) \
	(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
	
forward CheckAimLock(playerid);

enum TargetInfo
{
	targetid,
	Float:pos_x,
	Float:pos_y,
	Float:pos_z
}

new AimLockTarget[MAX_PLAYERS][TargetInfo];
new bool:IsPlayerAiming[MAX_PLAYERS];
new AimLockCheck[MAX_PLAYERS];
new AimAccuracy[MAX_PLAYERS];

GetPlayerSpeed(playerid)
{
	new Float:vx, Float:vy, Float:vz;
	GetPlayerVelocity(playerid, vx, vy, vz);
	return floatsqroot(floatpower(vx, 2) + floatpower(vy, 2) + floatpower(vz, 2));
}

public OnPlayerConnect(playerid)
{
	AimLockTarget[playerid][targetid] = -1;
	AimLockTarget[playerid][pos_x] = -1.0;
	AimLockTarget[playerid][pos_y] = -1.0;
	AimLockTarget[playerid][pos_z] = -1.0;
	
	IsPlayerAiming[playerid] = false;
	AimAccuracy[playerid] = 0;
	return 1;
}

public OnPlayerKeyStateChange(playerid, oldkeys, newkeys)
{
	new weapon = GetPlayerWeapon(playerid);
	if(RELEASED(KEY_AIM) && && IsPlayerAiming[playerid] && !IsPlayerInAnyVehicle(playerid))
	{
		IsPlayerAiming[playerid] = false;
		OnPlayerAim(playerid, weapon, WEAPON_MODE_RELEASE);
		return 1;
	}
	if(PRESSED(KEY_AIM) && !IsPlayerAiming[playerid] && !IsPlayerInAnyVehicle(playerid))//detect if player is holding aim
	{			
		switch(weapon)
		{
			case 22..34, 38:
			{
				IsPlayerAiming[playerid] = true;
				OnPlayerAim(playerid, weapon, WEAPON_MODE_HOLD);				
			}
		}
		return 1;
	}
	if(newkeys & KEY_AIM && !IsPlayerAiming[playerid] && !IsPlayerInAnyVehicle(playerid))//detect if player is holding aim
	{			
		switch(weapon)
		{
			case 22..34, 38:
			{
				IsPlayerAiming[playerid] = true;
				OnPlayerAim(playerid, weapon, WEAPON_MODE_AIM);				
			}
		}
		return 1;
	}
	return 1;
}

forward OnPlayerAim(playerid, &weapon, &mode);
public OnPlayerAim(playerid, &weapon, &mode)
{
	if(!mode)
	{
		AimLockTarget[playerid][targetid] = -1;
		AimLockTarget[playerid][pos_x] = -1.0;
		AimLockTarget[playerid][pos_y] = -1.0;
		AimLockTarget[playerid][pos_z] = -1.0;
		return KillTimer(AimLockCheck[playerid]);
	}
	switch(weapon)
	{
		case 22..33:
		{
			AimLockCheck[playerid] = SetTimerEx("CheckAimlock", 100, true, "i", playerid);
		}
	}
	return 1;
}
/*----------------> events <-------------------*/
public OnPlayerDeath(playerid, killerid, weapon)
{
	return 1;
}

public OnPlayerDisconnect(playerid)
{
	return 1;
}
/*---------------------------------------------*/


public CheckAimLock(playerid)
{	
	if(!IsPlayerAiming(playerid))
	{		
		AimLockTarget[playerid][targetid] = -1;
		AimLockTarget[playerid][pos_x] = -1.0;
		AimLockTarget[playerid][pos_y] = -1.0;
		AimLockTarget[playerid][pos_z] = -1.0;
		return KillTimer(AimLockCheck[playerid]);
	}
	
	if(AimLockTarget[playerid][targetid] >= 0 && AimLockTarget[playerid][targetid] <= MAX_PLAYERS)
	{
		if(!IsPlayerAimingAtPlayer(playerid, AimLockTarget[playerid][targetid]))
		{	
			AimLockTarget[playerid][targetid] = -1;
			AimLockTarget[playerid][pos_x] = -1.0;
			AimLockTarget[playerid][pos_y] = -1.0;
			AimLockTarget[playerid][pos_z] = -1.0;
			AimAccuracy[playerid] --;
		}
	}
	
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	
	for(new i; i < MAX_PLAYERS; i++)
	{
		if(!IsPlayerConnected(playerid)) continue;
		if(!IsPlayerInRangeOfPoint(playerid, 20.0, x, y, z)) continue;				
		new Float:tx, Float:ty, Float:tz;
		GetPlayerPos(i, tx, ty, tz);
		if(!IsPlayerAimingAtPlayer(playerid, i)) continue;
		if(GetPlayerSpeed(i) < 0.1) return 1;
		AimLockTarget[playerid][targetid] = i;
		AimLockTarget[playerid][pos_x] = tx;
		AimLockTarget[playerid][pos_y] = ty;
		AimLockTarget[playerid][pos_z] = tz;
		return AimAcuraccy[playerid] ++;
	}
	return 1;
}
Reply


Messages In This Thread
Anti-Aimbot by ipsLeon - by n0minal - 20.04.2015, 18:39
Re: Anti-Aimbot by ipsLeon - by JkS - 20.04.2015, 18:45
Re: Anti-Aimbot by ipsLeon - by DiegoCosta - 20.04.2015, 18:47
Re: Anti-Aimbot by ipsLeon - by ipsLuan - 20.04.2015, 18:48
Re: Anti-Aimbot by ipsLeon - by n0minal - 20.04.2015, 18:51
Re: Anti-Aimbot by ipsLeon - by Rodrigo_Avenged - 20.04.2015, 21:22
Re: Anti-Aimbot by ipsLeon - by D3sconn3ct - 20.04.2015, 21:26
Re: Anti-Aimbot by ipsLeon - by PT - 20.04.2015, 22:43
Re: Anti-Aimbot by ipsLeon - by n0minal - 20.04.2015, 23:37
Re: Anti-Aimbot by ipsLeon - by WLSF - 21.04.2015, 00:03
Re: Anti-Aimbot by ipsLeon - by n0minal - 21.04.2015, 00:09
Re: Anti-Aimbot by ipsLeon - by ProKillerpa - 21.04.2015, 00:50
Re: Anti-Aimbot by ipsLeon - by n0minal - 21.04.2015, 01:05
Re: Anti-Aimbot by ipsLeon - by SkullFire - 21.04.2015, 01:05
Re: Anti-Aimbot by ipsLeon - by n0minal - 21.04.2015, 01:28
Re: Anti-Aimbot by ipsLeon - by JkS - 21.04.2015, 15:01
Re: Anti-Aimbot by ipsLeon - by n0minal - 21.04.2015, 16:19
Re: Anti-Aimbot by ipsLeon - by JonathanFeitosa - 21.04.2015, 16:28
Re: Anti-Aimbot by ipsLeon - by n0minal - 21.04.2015, 17:18
Re: Anti-Aimbot by ipsLeon - by NikiFor - 21.04.2015, 18:36
Re: Anti-Aimbot by ipsLeon - by JonathanFeitosa - 21.04.2015, 18:43
Re: Anti-Aimbot by ipsLeon - by PT - 21.04.2015, 18:43
Re: Anti-Aimbot by ipsLeon - by n0minal - 21.04.2015, 19:28
Re: Anti-Aimbot by ipsLeon - by ReyMysterio - 21.04.2015, 19:38
Re: Anti-Aimbot by ipsLeon - by n0minal - 21.04.2015, 19:55
Re: Anti-Aimbot by ipsLeon - by NikiFor - 21.04.2015, 21:41
Re: Anti-Aimbot by ipsLeon - by Jimmmy - 22.04.2015, 03:07
Re: Anti-Aimbot by ipsLeon - by n0minal - 23.04.2015, 14:57
Re: Anti-Aimbot by ipsLeon - by Sky™ - 24.04.2015, 16:23
Re: Anti-Aimbot by ipsLeon - by n0minal - 24.04.2015, 17:24
Re: Anti-Aimbot by ipsLeon - by Gii - 24.04.2015, 22:12
Re: Anti-Aimbot by ipsLeon - by n0minal - 24.04.2015, 22:21
Re: Anti-Aimbot by ipsLeon - by Gii - 24.04.2015, 23:08
Re: Anti-Aimbot by ipsLeon - by Adejair_Junior - 25.04.2015, 01:51
Re: Anti-Aimbot by ipsLeon - by n0minal - 25.04.2015, 02:15
Re: Anti-Aimbot by ipsLeon - by FStralioti - 25.04.2015, 23:35
Re: Anti-Aimbot by ipsLeon - by n0minal - 27.04.2015, 02:17
Re: Anti-Aimbot by ipsLeon - by LockedLucas - 27.04.2015, 10:20
Re: Anti-Aimbot by ipsLeon - by Mr.Hardy - 27.04.2015, 10:32
Respuesta: Anti-Aimbot by ipsLeon - by vulgo - 21.06.2016, 16:38
Re: Respuesta: Anti-Aimbot by ipsLeon - by zSuYaNw - 21.06.2016, 18:27

Forum Jump:


Users browsing this thread: 6 Guest(s)