18.09.2012, 17:28
pawn Код:
forward UpdateSpeedo( );
public UpdateSpeedo ( )
{
for( new u; u < MAX_PLAYERS; u ++ )
{
if( InCar [ u ] == true )
{
new
Float:speed,
str [ 64 ];
speed = GetPlayerSpeed( u, false );
format( str, 64, "~b~MPH: ~w~%02f", speed );
PlayerTextDrawSetString( u, Speedo [ u ], str );
}
}
return true;
}
pawn Код:
stock Float:GetPlayerSpeed(playerid, bool:KMH)
{
new Float:Speed, Float:vX, Float:vY, Float:vZ;
if(!IsPlayerInAnyVehicle(playerid)) GetPlayerVelocity(playerid, vX, vY, vZ);
else GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
Speed = floatsqroot(((vX*vX)+(vY*vY))+(vZ*vZ));
return KMH ? (Speed*100.0) : (Speed*62.1371);
}
I would like it to just be 59. I tried %0.2f and it didn't work, so what do I do?