SA-MP Forums Archive
float and datetime (mysql) - 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: float and datetime (mysql) (/showthread.php?tid=651822)



float and datetime (mysql) - EvgeniyHostel1992 - 28.03.2018

Float:

I want the gasoline displayed in hundredths (for example 50,48L)

format (strb, sizeof (strb), "~ y ~ Fuel: ~ b ~% d", gasoline);
TextDrawSetString (Benzin [playerid], string);

how to display? % f or% 2.f?

DATATIME:

I save the date in the database for a period of months using NOW () - it is saved perfectly, just the question of how to display in the game? -% s? - does not exit,% f is also ..

i-number, s -text, f- with floating point. And what about DATATIME in mysql? -% s,% i, or what?


Re: float and datetime (mysql) - EvgeniyHostel1992 - 28.03.2018

for example: if benzin 50L then it is displayed 50L,
IF 50.06L then it is displayed: 457675673465783465L ....


Re: float and datetime (mysql) - m4karow - 28.03.2018

you have to declare the variable like this

new Float:Benzin[MAX_PLAYERS];

and you can simply use "%.2f"


Re: float and datetime (mysql) - ForCop - 28.03.2018

Quote:
Originally Posted by EvgeniyHostel1992
Посмотреть сообщение
Float:

I want the gasoline displayed in hundredths (for example 50,48L)

format (strb, sizeof (strb), "~ y ~ Fuel: ~ b ~% d", gasoline);
TextDrawSetString (Benzin [playerid], string);

how to display? % f or% 2.f?

DATATIME:

I save the date in the database for a period of months using NOW () - it is saved perfectly, just the question of how to display in the game? -% s? - does not exit,% f is also ..

i-number, s -text, f- with floating point. And what about DATATIME in mysql? -% s,% i, or what?


%.1f - 0.0
%.2f - 0.00
%.3f - 0.000
%.4f - 0.0000
etc....