Advertisement
Guest User

sdsdsd

a guest
Jul 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. public OnGameModeInit() {
  4. SetTimer("AntiSpeed", 100, true);
  5. return 1;
  6. }
  7.  
  8. new bool:GetCheck,Float:LastSpeed[MAX_PLAYERS];
  9.  
  10. forward AntiSpeed(playerid);
  11. public AntiSpeed(playerid) {
  12. for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) {
  13. if(IsPlayerConnected(i) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
  14. new vehid = GetPlayerVehicleID(i),Float:speed = GetSpeed(vehid);
  15. if(GetCheck) {
  16. LastSpeed[i] = speed;
  17. } else {
  18. new string[128],Float:dif;
  19. if(speed > LastSpeed[i]) dif = speed - LastSpeed[i];
  20. format(string,128,"LastSpeed: %f | Current speed: %f | dif: %f",LastSpeed[i],speed,dif);
  21. SendClientMessage(i,-1,string);
  22. }
  23. GetCheck = !GetCheck;
  24. }
  25. }
  26. }
  27.  
  28.  
  29. GetSpeed(vehicleid)
  30. {
  31. new Float:x,Float:y, Float:z,vel;
  32. GetVehicleVelocity( vehicleid, x, y, z );
  33.  
  34. vel = floatround( floatsqroot( x*x + y*y + z*z ) * 180 / 1.609344 ); // MPH
  35.  
  36. return vel;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement