Advertisement
Guest User

Untitled

a guest
Jul 10th, 2012
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define YELLOW 0xF6F600AA
  4.  
  5. forward SpeedoUpdate();
  6. new Text:box[MAX_PLAYERS],Text:speed[MAX_PLAYERS];
  7.  
  8. public OnFilterScriptInit()
  9. {
  10. SetTimer("SpeedoUpdate",100,1);
  11. return 1;
  12. }
  13.  
  14. public OnPlayerConnect(playerid)
  15. {
  16. speed[playerid] = TextDrawCreate(499.00,102.000000,"_");
  17. TextDrawLetterSize(speed[playerid],0.5,2);
  18. TextDrawSetOutline(speed[playerid],2);
  19. TextDrawColor(speed[playerid],YELLOW);
  20. TextDrawFont(speed[playerid],1);
  21. return 1;
  22. }
  23.  
  24. public OnPlayerDisconnect(playerid, reason)
  25. {
  26. TextDrawDestroy(speed[playerid]);
  27. return 1;
  28. }
  29.  
  30. public SpeedoUpdate()
  31. {
  32. for(new i = 0;i<MAX_PLAYERS;i++)
  33. {
  34. if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
  35. {
  36. new Float:x,Float:y,Float:z,Float:hp,string[24],vehicleid = GetPlayerVehicleID(i);
  37. TextDrawShowForPlayer(i,speed[i]);
  38. GetVehicleVelocity(vehicleid,x,y,z);
  39. format(string,sizeof(string),"Brzina: %dkph",floatround(floatsqroot(((x*x)+(y*y))+(z*z))*250.666667));
  40. TextDrawSetString(speed[i],string);
  41. format(string,sizeof(string),"Health: %d",floatround(hp));
  42. }
  43. if(!IsPlayerInAnyVehicle(i))
  44. {
  45. TextDrawHideForPlayer(i,box[i]);
  46. TextDrawHideForPlayer(i,speed[i]);
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement