21.10.2014, 12:36
Eyy, i have a speedmeter system but its not showing up what do i need to do
OnPlayerStatechange
There are no errors and i maked two playertextdraw so thats why PlayerTextDrawShow/Hide
pawn Код:
forward Speedo(playerid);
public Speedo(playerid) {
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) {
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);
format(speed_string,256,"Speed: %i Km/H",final_speed_int);
TextDrawSetString(Speedoo[i], speed_string);
} else {
TextDrawSetString(Speedoo[i], "Speed: 0 Km/H ");
}
}
return 1;
}
pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) {
TextDrawShowForPlayer(playerid,Speedoo[playerid]);
PlayerTextDrawShow(playerid, dashboard[playerid]);
PlayerTextDrawShow(playerid, carhealth[playerid]);
}
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) {
TextDrawHideForPlayer(playerid,Speedoo[playerid]);
PlayerTextDrawHide(playerid, dashboard[playerid]);
PlayerTextDrawHide(playerid, carhealth[playerid]);
}
return 1;
}