12.01.2014, 22:36
Hello there community of SA-MP. I am requesting help, because my speedometer is not really working how I want it to work.
And it is displaying when the player goes into a vehicle yes. Can somene tell me, why the speedo stays at the 100 miles pr. hour displayed in the textdraw?
pawn Код:
forward Speedo(playerid);
public Speedo(playerid)
{
new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[24],final_speed_int;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*95.0;
final_speed_int = floatround(final_speed, floatround_round);
if(final_speed_int >= 60)format(speed_string, sizeof(speed_string), "~b~S~w~peed: ~b~%i MPH", final_speed_int);
else format(speed_string, sizeof(speed_string), "~b~S~w~peed: ~b~%i MPH", final_speed_int);
TextDrawSetString(Speed[playerid], speed_string);
return 1;
}
pawn Код:
stock ShowVehicleTextdraws(playerid)
{
Speed[playerid] = TextDrawCreate(489.000122, 357.155487, "~b~S~w~peed: ~b~ 100");
TextDrawLetterSize(Speed[playerid], 0.449999, 1.600000);
TextDrawAlignment(Speed[playerid], 1);
TextDrawColor(Speed[playerid], -1);
TextDrawSetShadow(Speed[playerid], 0);
TextDrawSetOutline(Speed[playerid], 1);
TextDrawBackgroundColor(Speed[playerid], 51);
TextDrawFont(Speed[playerid], 1);
TextDrawSetProportional(Speed[playerid], 1);
TextDrawShowForPlayer(playerid, Text:Speed[playerid]);
return 1;
}