detect spec hack?
#1

Someone who has some effective code against this trap they use to spy on other players

Thank you!
Reply
#2

Check if the player is in spectating mode
Reply
#3

Does not work, since the player is still on PLAYER_STATE_ONFOOT ...
Reply
#4

You can compare GetPlayerCameraPos with GetPlayerPos.

https://sampwiki.blast.hk/wiki/GetPlayerCameraPos
https://sampwiki.blast.hk/wiki/GetPlayerPos
Reply
#5

Quote:
Originally Posted by LEOTorres
Посмотреть сообщение

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
        

Reply
#6

https://sampforum.blast.hk/showthread.php?tid=631567
https://sampforum.blast.hk/showthread.php?tid=487708
Reply
#7

I do not think it will help my problem
Reply
#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
#9

The camera is away from the player, in mode 4 so high values are not allowed, also spectating player must be streamed.
http://i.imgur.com/Q5kgK3Q.png
Reply
#10

PHP код:
stock bool:IsPlayerFakeSpectating(playerid,bool:force_disable=true){
    if(
GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && IsPlayerAdmin(playerid)) return false//admins spectacing detect
    
if(GetPlayerCameraMode(playerid) != 4) return false;
    new 
Float:px,Float:py,Float:pz,Float:cx,Float:cy,Float:cz;
    
GetPlayerPos(playerid,px,py,pz);
    
GetPlayerCameraPos(playerid,cx,cy,cz);
    if(
VectorSize(px-cx,py-cy,pz-cz) < 20.0) return false;
    
    if(
force_disableSetCameraBehindPlayer(playerid);
    return 
true;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)