#1

i added on my script samp real time but i want make mins to sec any idea?
Reply
#2

It has to do something with division by 60 (modulo is your friend as well)
Reply
#3

1 Minute = 60 Seconds.
Your minutes * 60 == Seconds you need.
Reply
#4

i know but where i need put?

PHP код:
new Text:txtTimeDisp;
new 
hourminute;
new 
timestr[32]; 
PHP код:
public UpdateTime()
{
    
gettime(hourminute);
       
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++;
    }

Reply
#5

pawn Код:
new hour, minute, second, timestr[10];
pawn Код:
gettime(hour, minute, second);
format(timestr,10,"%02d:%02d:%02d",hour,minute,second);
Reply
#6

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
Reply
#7

Make timestr[11] or timestr[12]
Reply
#8

Quote:
Originally Posted by thefatshizms
Посмотреть сообщение
Make timestr[11] or timestr[12]
same not working
Reply
#9

Not working as in what? How often is your UpdateTime called?

@thefatshizms: 10 will suffice - HH:mms is always 9 chars long. The format argument length is in not connected to output string buffer size
Reply
#10

@misiur You gave him one with seconds as well making it 11 chars long.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)