28.08.2010, 10:17
Before a year I`ve looking whole day to find some speedometer for my server... So i decided to give you one cool 
URL: https://sampforum.blast.hk/showthread.php?tid=161275
Thanks to mckennie but there are guys that dont know how to use it so I make it easyer...
Lets start...
On top of the screen add this:
Put this in end of a script:
So this is some kind of speedometer...you can use it simply like:
So this is it
...I hope this will help you
...
Sorry for bad english :S...

URL: https://sampforum.blast.hk/showthread.php?tid=161275
Thanks to mckennie but there are guys that dont know how to use it so I make it easyer...
Lets start...

On top of the screen add this:
Code:
forward GetVehicleSpeed(vehicleid);
Code:
public GetVehicleSpeed(vehicleid) {
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
if(vehicleid != 0) {
GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136;
final_speed_int = floatround(final_speed,floatround_round);
return 1; }
return final_speed_int; }
So this is some kind of speedometer...you can use it simply like:
Code:
new Text:speedtext[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
speedtext[playerid] = TextDrawCreate(510, 105, "~g~Speed~w~: 0 Km/h");
TextDrawFont(speedtext[playerid], 3);
TextDrawLetterSize(speedtext[playerid], 0.4, 1.4);
TextDrawSetOutline(speedtext[playerid], 1);
return 1; }
public OnPlayerStateChange(playerid, oldstate, newstate) {
new vid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER) {
new string[256];
format(string,sizeof(string),"~g~Speed~w~: %d Km/h", GetVehicleSpeed(vid));
TextDrawSetString(speedtext[playerid], string);
TextDrawShowForPlayer(playerid, speedtext[playerid]);
}else if(newstate == PLAYER_STATE_ONFOOT) {
TextDrawHideForPlayer(playerid, speedtext[playerid]);
return 1; }
return 1; }
public OnPlayerDisconnect(playerid) {
TextDrawDestroy(speedtext[playerid]);
return 1; }
...I hope this will help you
...Sorry for bad english :S...

