Jump to content
  • 0

Intrebare float


BuNiCu-RP

Question

Salut, ma tot bat cu un float de cateva zile, sper ca voi sa imi dati o solutie buna.

new Float:converTime = floatround(floatmul(PlayerInfo[i][pPayDay]/60+1, 0.99), floatround_ceil);
format(stringsu,sizeof(stringsu),"Ai primit %.2f ore jucate (Ai jucat %d minute pe server) ", converTime, PlayerInfo[i][pPayDay]/60+1);

iar rezultatul este ceva de genul: Ai primit 33.0 ore jucate (Ai jucat 33 minute pe server) asi dori ceva de genul:

Ai primit 0.33 ore jucate (Ai jucat 33 minute pe server) cand e sub 55 minute jucate

si cand este peste 55 minute sa arate ceva de genu:

Ai primit 1 ore jucate (Ai jucat 55 minute pe server) 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Pai poti sa imparti direct la 60 de minute sa afli cate ore a jucat, fara sa mai faci toate alea. In loc de

floatround(floatmul(PlayerInfo[i][pPayDay]/60+1, 0.99), floatround_ceil);

poti sa pui mai simplu

floatdiv(PlayerInfo[i][pPayDay], 60);

Si asa daca ai 30 de minute jucate o sa ai 0.55 ore jucate.

https://wiki.sa-mp.com/wiki/Floatdiv

  • Upvote 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.