30.10.2012, 21:51
Hey guys, somehow my speedometer is fucked.
Code:
When two (or more) players are in separated vehicles it will show to one of the two players this:
http://i45.tinypic.com/2ed47k7.png
Thanks!
Code:
Код:
public Speedometer()
{
new vehicleid, Float:health;
new engine, lights, alarm, doors, bonnet, boot, objective;
new fstring[32], string[512];
new string2[32], string3[104];
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
vehicleid = GetPlayerVehicleID(i);
GetVehicleHealth(vehicleid, health);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
strcat(string, " ", sizeof(string));
strcat(string, GetPlayer3DZone(i), sizeof(string));
strcat(string2, "Fuel:~w~", sizeof(string2));
fstring = "iiiiiiiiii";
if(Fuel[vehicleid] > 100.0) strins(fstring, "~r~", 10, sizeof(fstring));
else if(Fuel[vehicleid] < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
else strins(fstring, "~r~", floatround(Fuel[vehicleid]/10.0), sizeof(fstring));
strcat(string2, fstring, sizeof(string2));
strcat(string3, " ", sizeof(string3));
if(GetPVarInt(i, "Speedo")) format(fstring,sizeof(fstring),"mph: ~w~%d", GetPlayerSpeed(i, false));
else format(fstring,sizeof(fstring),"KPH: ~w~%d", GetPlayerSpeed(i, true));
strcat(string3, fstring, sizeof(string3));
PlayerTextDrawSetString(i, SpeedoText, string3);
PlayerTextDrawSetString(i, FuelText, string2);
}
}
}
http://i45.tinypic.com/2ed47k7.png
Thanks!

