18.12.2012, 07:25
I saw that noone actually made an easy to understand anti speed hack tutorial, so here it is. This is very simple tutorial for those who are new to PAWN and are looking for anti hack scripts. Please only comment if you find it useful, and don't forget to +1 my Rep if this helps you.
1.Put this code in OnPlayerConnect:
This creates a timer which checks for the player's vehicle speed every 100ms.
2.Forward the function | Put this code under the OnPlayerConnect function:
For example:
3.Now again under the "forward CheckHacks(playerid)" put this code:
This will check the vehicle speed using GetVehicleSpeed (we are going to create this function) and if the speed is more than 1000, then the player will be kicked.
4.Put this code anywhere in your script:
This function returns the vehicle speed for the given vehicle id, which we provide in step 3.
Hope this was useful to you in any way! Thank you, please +1 My reputation if I helped!
1.Put this code in OnPlayerConnect:
Код:
SetTimerEx("CheckSpeed", 100, true, "i", playerid);
2.Forward the function | Put this code under the OnPlayerConnect function:
Код:
forward CheckHacks(playerid);
Код:
public OnPlayerConnect(playerid){ SetTimerEx("CheckSpeed", 100, true, "i", playerid); } forward CheckHacks(playerid);
Код:
public CheckHacks(playerid){ if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) > 1000){ Kick(playerid); } }
4.Put this code anywhere in your script:
Код:
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); }
Hope this was useful to you in any way! Thank you, please +1 My reputation if I helped!