Jump to content
  • 0

pomoc Vypsaní zbývajíciho času


Pavel Tuček

Dotaz

Zdravím.. mám udelanej system na dane a rád bych se zeptal, jak mám udelat aby mi to vypsalo napr. zustava 5,32hod. [tj. 5 hodín,32 min.] Ted to zobrazuje "Dan muzes vyplatit za 5.00hod" .. a minuty nikde :(

new msg[150],Float:cas;
cas = PlayerInfo[playerid][MuzeVyplatitDan]/3600 - gettime()/3600;
format(msg, 150, "Dan muzes vyplatit za %.2f hod", cas);
SendClientMessage(playerid,-1, msg);
Edited by Pavel Tuček
Link to comment
Share on other sites

17 odpovědí na tuto otázku

Recommended Posts

  • 0
new msg[144];
new cas = (PlayerInfo[playerid][MuzeVyplatitDan] - gettime())/60;//cas v minutach
format(msg,sizeof(msg),"Dan muzes vyplatit za %d:%02d",cas/60,cas%60);// cas/60 = pocet hodin cas%60 % celociselny zbytek po deleni tzn minuty
SendClientMessage(playerid,-1,msg);

netestovano ale myslenka je myslim jasna

Edited by ATomas
Link to comment
Share on other sites

  • 0
  • Globální moderátor

(pawno po ruce nemám)
 
PlayerInfo[playerid][MuzeVyplatitDan] <- Když to testuješ tak toto je čas v budoucnu kdy může vyplatit, máš vyzkoušeno že to tomu tak je? a samozřejmě to musí hrubý čas ve formátu co vyhazuje gettime()


pro test 

print(PlayerInfo[playerid][MuzeVyplatitDan] - gettime());
Link to comment
Share on other sites

  • 0
  • Globální moderátor

Proste daj ten čas vynasobit 60 a maš po bugu.

 

podle mě 0:04 nebudou 4 hodiny ale 4 minuty... :) protože to od ATomase by mělo ukazovat správný čas... 

Link to comment
Share on other sites

  • 0

 

(pawno po ruce nemám)

 

PlayerInfo[playerid][MuzeVyplatitDan] <- Když to testuješ tak toto je čas v budoucnu kdy může vyplatit, máš vyzkoušeno že to tomu tak je? a samozřejmě to musí hrubý čas ve formátu co vyhazuje gettime()

pro test 

print(PlayerInfo[playerid][MuzeVyplatitDan] - gettime());

Ano, je tomu tak a je to hrubý čas.

Link to comment
Share on other sites

  • 0
  • Globální moderátor

no tak to by mělo jít, hodíš mi sem prosím ještě kod kde zadáváš čas ?

PlayerInfo[playerid][MuzeVyplatitDan]
Link to comment
Share on other sites

  • 0

zkus tohle jen pro info jakej ti to ukaze cas..

new msg[144];
PlayerInfo[playerid][MuzeVyplatitDan] = gettime()+3600*5;
new cas = (PlayerInfo[playerid][MuzeVyplatitDan] - gettime())/60;//cas v minutach
format(msg,sizeof(msg),"Dan muzes vyplatit za %d:%02d",cas/60,cas%60);// cas/60 = pocet hodin cas%60 % celociselny zbytek po deleni tzn minuty
SendClientMessage(playerid,-1,msg);
  • Líbí se mi to! (+1) 1
Link to comment
Share on other sites

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