16.01.2012, 16:42
Hey I created my own speedometer but it doesnt want to show up..Heres the codes:
Anyone see an issue? thanks in advance.
pawn Код:
new Text:SPEEDOS[MAX_PLAYERS];
new Text:SPEEDOMPH[MAX_PLAYERS];
pawn Код:
SPEEDOS[playerid] = TextDrawCreate(587.000000, 357.000000, " ");
TextDrawColor(SPEEDOS[playerid], 16711935);
TextDrawSetOutline(SPEEDOS[playerid], 1);
TextDrawShowForPlayer(playerid,SPEEDOS[playerid]);
SPEEDOMPH[playerid] = TextDrawCreate(580.000000, 422.000000, "M.P.H");
TextDrawLetterSize(SPEEDOMPH[playerid], 0.500000, 2.000000);
TextDrawColor(SPEEDOMPH[playerid], -65281);
pawn Код:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
TextDrawShowForPlayer(playerid,SPEEDOS[playerid]);
TextDrawShowForPlayer(playerid,SPEEDOMPH[playerid]);
SetTimer("Speedometer", 100, true);
}
pawn Код:
public Speedometer(playerid)
{
new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
vehicleid = GetPlayerVehicleID(playerid);
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))*85.416672; // 250.666667 = kmph // 199,4166672= mph
final_speed_int = floatround(final_speed,floatround_round);
format(speed_string,256,"%i ",final_speed_int);
TextDrawSetString(SPEEDOS[playerid], speed_string);
}
else
{
TextDrawSetString(SPEEDOS[playerid], " ");
}
return 1;
}
Anyone see an issue? thanks in advance.