Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FilterScript By B4pt1st3du24.
- // ps : Ne retirer ces simples crédits !
- // Include.
- #include <a_samp>
- // Variable.
- new Text:COMPTEUR[MAX_PLAYERS];
- // Forward.
- forward VerificationCompteur();
- public OnPlayerConnect(playerid)
- {
- COMPTEUR[playerid] = TextDrawCreate(505.000000,102.000000,"");
- TextDrawBackgroundColor(COMPTEUR[playerid],255);
- TextDrawFont(COMPTEUR[playerid],2);
- TextDrawLetterSize(COMPTEUR[playerid],0.230000,1.000000);
- TextDrawColor(COMPTEUR[playerid],-1);
- TextDrawSetOutline(COMPTEUR[playerid],1);
- TextDrawSetProportional(COMPTEUR[playerid],1);
- TextDrawUseBox(COMPTEUR[playerid],1);
- TextDrawBoxColor(COMPTEUR[playerid],255);
- TextDrawTextSize(COMPTEUR[playerid],601.000000,0.000000);
- return 1;
- }
- public OnGameModeInit()
- {
- SetTimer("VerificationCompteur",50,true);
- return 1;
- }
- public VerificationCompteur()
- {
- new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- vehicleid=GetPlayerVehicleID(i);
- if(vehicleid==0)
- {
- TextDrawSetString(COMPTEUR[i],"");
- TextDrawHideForPlayer(i,COMPTEUR[i]);
- }
- else
- {
- TextDrawShowForPlayer(i,COMPTEUR[i]);
- GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
- final_speed=floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*115.0;
- final_speed_int=floatround(final_speed,floatround_round);
- if(final_speed_int<60)
- {
- format(speed_string,256,"Vitesse : ~g~%d~w~ km/h",final_speed_int);
- }
- else if(final_speed_int<90)
- {
- format(speed_string,256,"Vitesse : ~y~%d~w~ km/h",final_speed_int);
- }
- else
- {
- format(speed_string,256,"Vitesse : ~r~%d~w~ km/h",final_speed_int);
- }
- TextDrawSetString(COMPTEUR[i],speed_string);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement