detect spec hack?
#8

Quote:
Originally Posted by FelipeAndres
Посмотреть сообщение
I had tried that, but sometimes the position of the camera with that of the player varies a lot.

Would you help me improve it?

PHP код:
new Float:PosPlayer[3], Float:PosCamera[3];
        
GetPlayerCameraPos(playeridPosCamera[0], PosCamera[1], PosCamera[2]);
        
GetPlayerPos(playeridPosPlayer[0], PosPlayer[1], PosPlayer[2]);
        new 
Float:PosFinal[3];
        
PosFinal[0] = PosCamera[0]-PosPlayer[0];
        
PosFinal[1] = PosCamera[1]-PosPlayer[1];
        if(
PosFinal[0] > 20 || PosFinal[0] < -20)
        {
            
//cheat
        
}
        if(
PosFinal[1] > 20 || PosFinal[1] < -20)
        {
            
//cheat
        

You are correct that the camera position can vary quite a lot, in particular when a player is surfing a vehicle and repeatedly aims his weapon and when a player teleports with G his camera change is delayed.

What I would recommend is having more checks to see whether the player is in fact using the spectate cheat, or it's just a bug or abnormal change in the game. This can be done by changing the players position back to default upon detection of the cheat the first time, then when a quick change is remade, you can be more likely positive that the player is using the spectate cheat.

Код:
new specWarn[MAX_PLAYERS];

forward ResetSpecWarn (playerid);

new Float:PosPlayer[3], Float:PosCamera[3];
GetPlayerCameraPos(playerid, PosCamera[0], PosCamera[1], PosCamera[2]);
GetPlayerPos(playerid, PosPlayer[0], PosPlayer[1], PosPlayer[2]);
new Float:PosFinal[3];

PosFinal[0] = PosCamera[0] - PosPlayer[0];
PosFinal[1] = PosCamera[1] - PosPlayer[1];

new surf = GetPlayerSurfingVehicleID(playerid);
new seat = GetPlayerVehicleSeat (playerid);

if(PosFinal[0] > 20 || PosFinal[0] < -20 || PosFinal[1] > 20 || PosFinal[1] < -20)
{
	if (specWarn[playerid] == 0)
	{
		specWarn[playerid] = 1;
		SetCameraBehindPlayer(playerid);
		SetTimerEx("ResetSpecWarn", 60000, false, "i", playerid);
		return 1;
	}

	if (surf != INVALID_VEHICLE_ID)
	{
		//player is using cheats or surfing is affecting the camera?
		return 1;
	}
		
	if (seat > 0)
	{
		//player is using cheats or g camera bug?
		return 1;
	}
	
	//player is using cheats (most likely)
}

public ResetSpecWarn (playerid)
{
	specWarn[playerid] = 0;
	return 1;
}
Best thing to do in initial stages, send message to admin in the instance of this activating; then proceed to spectate to decide whether the system is adequate enough to detect the cheats.
Reply


Messages In This Thread
detect spec hack? - by FelipeAndres - 15.04.2017, 17:15
Re: detect spec hack? - by GangstaSunny. - 15.04.2017, 17:39
Respuesta: detect spec hack? - by FelipeAndres - 15.04.2017, 17:44
Re: detect spec hack? - by LEOTorres - 15.04.2017, 17:54
Respuesta: Re: detect spec hack? - by FelipeAndres - 15.04.2017, 17:58
Re: detect spec hack? - by Unrea1 - 15.04.2017, 18:08
Respuesta: Re: detect spec hack? - by FelipeAndres - 15.04.2017, 18:23
Re: Respuesta: Re: detect spec hack? - by LEOTorres - 15.04.2017, 18:24
Re: detect spec hack? - by AbyssMorgan - 15.04.2017, 18:33
Re: detect spec hack? - by AbyssMorgan - 15.04.2017, 19:11

Forum Jump:


Users browsing this thread: 1 Guest(s)