Speed Float
#1

look i want it like this: 100.0

PHP код:
format(TD_String25"%01.2f"VehicleFuel[vehicleid]/100.0); 
please help il give rep if you really want..but i know you dont :P
Reply
#2

pawn Код:
//If you meant getting player's speed Here's a stock that gets it
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)) * 179.28625;
    return floatround(ST[3]);
}
Reply
#3

pawn Код:
%.01f
Will return a float with atleast 1 zero after the , and max 1 character after the ,

Examples:

1064.0
15.5
568.0
65.2
0.1
0.0
56.9
Reply
#4

If you had the float value 3.1, the format %01.2f would set the string to "03. 1", which is not what you want.

The way it works, is that you put a 0 in front of a number. That number is the minimum amount of digits. %04f would always return a float with the format XXXX.XXXXX (standard 5 decimals), while the format %04.02f would always return a float with the format XXXX.XX.
Reply
#5

nothing is like 100.0 .... (
Reply
#6

anyone help it isnt 100.0..
Reply
#7

it isnt bump..i posted yesterday last time.

please anyone help it isnt 100.0 and i cant make it 100.0
Reply
#8

PHP код:
            new Float:FuelInFloat VehicleFuel[vehicleid];
            new 
FuelInInteger floatround(FuelInFloat);
            new 
FuelInString[4];
            
format(FuelInString,4,"%i.0",FuelInInteger); 
Reply
#9

perfect SAMPHAcker
Reply
#10

Quote:
Originally Posted by SAMPHacker
Посмотреть сообщение
PHP код:
            new Float:FuelInFloat VehicleFuel[vehicleid];
            new 
FuelInInteger floatround(FuelInFloat);
            new 
FuelInString[4];
            
format(FuelInString,4,"%i.0",FuelInInteger); 
Quote:
Originally Posted by Akcent_Voltaj
Посмотреть сообщение
perfect SAMPHAcker
Not even close to perfect.

Did you even read my reply?

pawn Код:
format( FuelInString, sizeof( FuelInString ), "%.1f", FuelInInteger );
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)