30.06.2012, 12:41
Hello guys as a friend of mine told me it would be better to use PlayerCreateTextdraw and all the related fuctions for a vehicle status system
Health:
Speed: etc..
But i still got the same problem which means that playerids > 0 doesn't show textdraw of Health and Speed why that happens?
Here is the code though.
Health:
Speed: etc..
But i still got the same problem which means that playerids > 0 doesn't show textdraw of Health and Speed why that happens?
Here is the code though.
pawn Код:
new PlayerText:SPEEDOS[MAX_PLAYERS];
new PlayerText:HEALTH[MAX_PLAYERS];
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);
new Float:vehicle_health,final_vehicle_health,health_string[256];
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))*250.666667;
final_speed_int = floatround(final_speed,floatround_round);
format(speed_string,256,"~y~Speed: ~w~%i",final_speed_int);
PlayerTextDrawSetString(playerid,SPEEDOS[playerid], speed_string);
PlayerTextDrawShow(playerid,SPEEDOS[playerid]);
GetVehicleHealth(vehicleid,vehicle_health);
final_vehicle_health = floatround(floatround(vehicle_health - 250)/ 7.5);
format(health_string,256,"~r~Health: ~w~%i", final_vehicle_health);
PlayerTextDrawSetString(playerid,HEALTH[playerid], health_string);
PlayerTextDrawShow(playerid,HEALTH[playerid]);
}
else
{
PlayerTextDrawSetString(playerid,SPEEDOS[playerid], " ");
PlayerTextDrawSetString(playerid,HEALTH[playerid], " ");
}
return 1;
}