clock - 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: clock (
/showthread.php?tid=413924)
clock -
sscarface - 07.02.2013
i added on my script samp real time but i want make mins to sec any idea?
Re: clock -
Misiur - 07.02.2013
It has to do something with division by 60 (modulo is your friend as well)
Re: clock -
RajatPawar - 07.02.2013
1 Minute = 60 Seconds.
Your minutes * 60 == Seconds you need.
Re: clock -
sscarface - 07.02.2013
i know but where i need put?
PHP код:
new Text:txtTimeDisp;
new hour, minute;
new timestr[32];
PHP код:
public UpdateTime()
{
gettime(hour, minute);
format(timestr,32,"%02d:%02d",hour,minute);
TextDrawSetString(txtTimeDisp,timestr);
SetWorldTime(hour);
new x=0;
while(x!=MAX_PLAYERS) {
if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) {
SetPlayerTime(x,hour,minute);
}
x++;
}
}
Re: clock -
Misiur - 07.02.2013
pawn Код:
new hour, minute, second, timestr[10];
pawn Код:
gettime(hour, minute, second);
format(timestr,10,"%02d:%02d:%02d",hour,minute,second);
Re: clock -
sscarface - 07.02.2013
Quote:
Originally Posted by Misiur
pawn Код:
new hour, minute, second, timestr[10];
pawn Код:
gettime(hour, minute, second); format(timestr,10,"%02d:%02d:%02d",hour,minute,second);
|
not working
Re: clock -
thefatshizms - 07.02.2013
Make timestr[11] or timestr[12]
Re: clock -
sscarface - 07.02.2013
Quote:
Originally Posted by thefatshizms
Make timestr[11] or timestr[12]
|
same not working
Re: clock -
Misiur - 07.02.2013
Not working as in what? How often is your UpdateTime called?
@thefatshizms: 10 will suffice - HH:mm

s is always 9 chars long. The format argument length is in not connected to output string buffer size
Re: clock -
thefatshizms - 07.02.2013
@misiur You gave him one with seconds as well making it 11 chars long.