Floats. "xx.0000000000"
#1

Alright, so, I hate asking for help sometimes.. but I don't know what's happening.

pawn Код:
stock GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]); else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180;
    return floatround(ST[3]);
}
I'm using this stock (credits to who made it) and Im' trying to make a simple speedo;
pawn Код:
new Float:speed = GetPlayerSpeed(playerid);
        format(string,sizeof(string), "%f KM/H", speed);
        TextDrawSetString(Speed[playerid], string);
However, in game, I get xx.00000000 KM/H. If someone could tell me how to limit the 0's, that'd be really fantastic! Thanks
Reply


Messages In This Thread
Floats. "xx.0000000000" - by TaMeD - 29.11.2010, 04:12
Re: Floats. "xx.0000000000" - by JaTochNietDan - 29.11.2010, 04:16

Forum Jump:


Users browsing this thread: 1 Guest(s)