SA-MP Forums Archive
Need help with anti speed 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: Need help with anti speed hack (/showthread.php?tid=568340)



Need help with anti speed hack - Mijata - 21.03.2015

how to create anti speed hack with car and without car


Re: Need help with anti speed hack - JaydenJason - 21.03.2015

have you made an attempt

have you even used the search function

https://sampforum.blast.hk/showthread.php?tid=166177


Re: Need help with anti speed hack - CalvinC - 21.03.2015

Use GetPlayerVelocity and GetVehicleVelocity to check if it's higher than a certain amount.
If it's too high, they're most likely using speed cheats.


Re: Need help with anti speed hack - Jimmy0wns - 21.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Use GetPlayerVelocity and GetVehicleVelocity to check if it's higher than a certain amount.
If it's too high, they're most likely using speed cheats.
But what if the player('s vehicle) is falling from e.g, Mount Chilliad?


Re: Need help with anti speed hack - Abagail - 21.03.2015

A vehicle should never reach more than 1000 MPH even when falling. So typically something such as:

pawn Код:
new LastHackReported[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
      LastHackReported[playerid] = 0;
}

public OnPlayerUpdate(playerid)
{
     if(IsPlayerInAnyVehicle(playerid) && GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 1000 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
     {
            LastHackReported[playerid]++;
            if(LastHackReported[playerid] == 5)
            {
                  CallLocalFunction("OnPlayerVehicleSpeedHack", "dd", playerid, GetPlayerVehicleID(playerid), GetVehicleSpeed(GetPlayerVehicleID(playerid));
                  LastHackReported[playerid] = 0;
            }
     }
 
     return 1;
}

stock GetVehicleSpeed(vehicleid)
{
    new Float:xPos[3];
    GetVehicleVelocity(vehicleid, xPos[0], xPos[1], xPos[2]);
    return floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 170.00);
}
forward OnPlayerVehicleSpeedHack(playerid, vehicleid, Float: MPH);
Something such as this should work(though it's untested). Basically it calls OnPlayerVehicleSpeedHack allowing you to take action appropriately.