Advertisement
Guest User

FS COMPTEUR

a guest
Feb 9th, 2012
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.84 KB | None | 0 0
  1. // FilterScript By B4pt1st3du24.
  2. // ps : Ne retirer ces simples crédits !
  3.  
  4. // Include.
  5.  
  6. #include <a_samp>
  7.  
  8. // Variable.
  9.  
  10. new Text:COMPTEUR[MAX_PLAYERS];
  11.  
  12. // Forward.
  13.  
  14. forward VerificationCompteur();
  15.  
  16. public OnPlayerConnect(playerid)
  17. {
  18.     COMPTEUR[playerid] = TextDrawCreate(505.000000,102.000000,"");
  19.     TextDrawBackgroundColor(COMPTEUR[playerid],255);
  20.     TextDrawFont(COMPTEUR[playerid],2);
  21.     TextDrawLetterSize(COMPTEUR[playerid],0.230000,1.000000);
  22.     TextDrawColor(COMPTEUR[playerid],-1);
  23.     TextDrawSetOutline(COMPTEUR[playerid],1);
  24.     TextDrawSetProportional(COMPTEUR[playerid],1);
  25.     TextDrawUseBox(COMPTEUR[playerid],1);
  26.     TextDrawBoxColor(COMPTEUR[playerid],255);
  27.     TextDrawTextSize(COMPTEUR[playerid],601.000000,0.000000);
  28.     return 1;
  29. }
  30.  
  31. public OnGameModeInit()
  32. {
  33.     SetTimer("VerificationCompteur",50,true);
  34.     return 1;
  35. }
  36.  
  37. public VerificationCompteur()
  38. {
  39.     new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
  40.     for(new i=0;i<MAX_PLAYERS;i++)
  41.     {
  42.         vehicleid=GetPlayerVehicleID(i);
  43.         if(vehicleid==0)
  44.         {
  45.             TextDrawSetString(COMPTEUR[i],"");
  46.             TextDrawHideForPlayer(i,COMPTEUR[i]);
  47.         }
  48.         else
  49.         {
  50.             TextDrawShowForPlayer(i,COMPTEUR[i]);
  51.             GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
  52.             final_speed=floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*115.0;
  53.             final_speed_int=floatround(final_speed,floatround_round);
  54.             if(final_speed_int<60)
  55.             {
  56.                 format(speed_string,256,"Vitesse : ~g~%d~w~ km/h",final_speed_int);
  57.             }
  58.             else if(final_speed_int<90)
  59.             {
  60.                 format(speed_string,256,"Vitesse : ~y~%d~w~ km/h",final_speed_int);
  61.             }
  62.             else
  63.             {
  64.                 format(speed_string,256,"Vitesse : ~r~%d~w~ km/h",final_speed_int);
  65.             }
  66.             TextDrawSetString(COMPTEUR[i],speed_string);
  67.         }
  68.     }
  69.     return 1;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement