Speed Float - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Speed Float (
/showthread.php?tid=410165)
Speed Float -
Akcent_Voltaj - 24.01.2013
look i want it like this: 100.0
PHP код:
format(TD_String, 25, "%01.2f", VehicleFuel[vehicleid]/100.0);
please help il give rep if you really want..but i know you dont :P
Re: Speed Float -
DaRk_RaiN - 24.01.2013
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]);
}
Re: Speed Float -
Sinner - 24.01.2013
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
Re: Speed Float -
LarzI - 24.01.2013
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.
Re: Speed Float -
Akcent_Voltaj - 24.01.2013
nothing is like 100.0 ....
(
Re: Speed Float -
Akcent_Voltaj - 24.01.2013
anyone help it isnt 100.0..
Re: Speed Float -
Akcent_Voltaj - 25.01.2013
it isnt bump..i posted yesterday last time.
please anyone help it isnt 100.0 and i cant make it 100.0
Re: Speed Float -
SAMPHacker - 25.01.2013
PHP код:
new Float:FuelInFloat = VehicleFuel[vehicleid];
new FuelInInteger = floatround(FuelInFloat);
new FuelInString[4];
format(FuelInString,4,"%i.0",FuelInInteger);
Re: Speed Float -
Akcent_Voltaj - 25.01.2013
perfect SAMPHAcker
Re: Speed Float -
LarzI - 25.01.2013
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 );