20.08.2010, 09:06
Hey!
I have a function:
but when I set up the timer under OnGameModeInit, and I get in a vehicle ingame, the timer do not update the speedo.
I have a function:
pawn Код:
function Speedometer()
{
loop(i, MAX_PLAYERS)
{
if(IsPlayerInAnyVehicle(i))
{
new
Float:pPos[3],
Float:speed,
str[128],
vehicleid = GetPlayerVehicleID(i),
Float:vHealth;
GetVehicleHealth(vehicleid, vHealth);
GetVehicleVelocity(vehicleid, pPos[0], pPos[1], pPos[2]);
speed = floatsqroot(floatpower(pPos[0], 2)+floatpower(pPos[1], 2)+floatpower(pPos[2], 2))*160.0;
format(str, sizeof(str), "%s\n%d km/h\n%d mp/h\n%d/1000", vehicleNames[vehicleid-400], floatround(speed, floatround_round), floatround(speed/1.6, floatround_round), floatround(vHealth, floatround_round));
UpdateDynamic3DTextLabelText(Speedo[i], colorSpeedo, str);
}
}
return 1;
}