Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- public OnGameModeInit() {
- SetTimer("AntiSpeed", 100, true);
- return 1;
- }
- new bool:GetCheck,Float:LastSpeed[MAX_PLAYERS];
- forward AntiSpeed(playerid);
- public AntiSpeed(playerid) {
- for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) {
- if(IsPlayerConnected(i) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
- new vehid = GetPlayerVehicleID(i),Float:speed = GetSpeed(vehid);
- if(GetCheck) {
- LastSpeed[i] = speed;
- } else {
- new string[128],Float:dif;
- if(speed > LastSpeed[i]) dif = speed - LastSpeed[i];
- format(string,128,"LastSpeed: %f | Current speed: %f | dif: %f",LastSpeed[i],speed,dif);
- SendClientMessage(i,-1,string);
- }
- GetCheck = !GetCheck;
- }
- }
- }
- GetSpeed(vehicleid)
- {
- new Float:x,Float:y, Float:z,vel;
- GetVehicleVelocity( vehicleid, x, y, z );
- vel = floatround( floatsqroot( x*x + y*y + z*z ) * 180 / 1.609344 ); // MPH
- return vel;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement