[Tutorial] Time System
#21

i made it like this because well its easier to make a day in samp with minutes because you can actually see the time changing from day to night and to me it looks better than taking a few hours to change from night to day that way people will enjoy the time changing anyway its easy to make add hours to this tut try it just add one more variable and make the timer reset the mins to 00 every 60 mins and then add 1 to the hours sorry if i am not being very clear if you need help with it pm me
Reply
#22

Nice tut
Reply
#23

Nice Tutorial AceFlyer Next time use this one

pawn Code:
public TimeU()
{
    new string[7];                            
    Tsec+=1;                                      
    if(Tsec==60) {                                
        Tsec=00;
        THrs+=1;                                  
    }
    if(THrs==24) {
        Tsec=00;
        THrs=0;
    }
    if(Tsec<10) {                                
                                                 
        format(string,sizeof(string),"%d:%d0",THrs,Tsec);
    }
    if(Tsec>10) {
                                                 
        format(string,sizeof(string),"%d:%02d",THrs,Tsec);
    }
    if(THrs<10) {
                                                 
        format(string,sizeof(string),"0%d:%02d",THrs,Tsec);
    }
    for(new i; i<MAX_PLAYERS; i++) {              
        if(IsPlayerConnected(i)) {              
            SetPlayerTime(i,THrs,Tsec);          
        }
    }
    TextDrawSetString(Time,string);
    return 1;
}
so theres 0 before the numer 1 to 9 like this

"06:01" anyway i love it! i using it on my gangwar gamemode
Reply
#24

Quote:
Originally Posted by GAMER_PS2
View Post
Nice Tutorial AceFlyer Next time use this one

pawn Code:
public TimeU()
{
    new string[7];                            
    Tsec+=1;                                      
    if(Tsec==60) {                                
        Tsec=00;
        THrs+=1;                                  
    }
    if(THrs==24) {
        Tsec=00;
        THrs=0;
    }
    if(Tsec<10) {                                
                                                 
        format(string,sizeof(string),"%d:%d0",THrs,Tsec);
    }
    if(Tsec>10) {
                                                 
        format(string,sizeof(string),"%d:%02d",THrs,Tsec);
    }
    if(THrs<10) {
                                                 
        format(string,sizeof(string),"0%d:%02d",THrs,Tsec);
    }
    for(new i; i<MAX_PLAYERS; i++) {              
        if(IsPlayerConnected(i)) {              
            SetPlayerTime(i,THrs,Tsec);          
        }
    }
    TextDrawSetString(Time,string);
    return 1;
}
so theres 0 before the numer 1 to 9 like this

"06:01" anyway i love it! i using it on my gangwar gamemode
If people plans to copy and paste (like me xD because this is amazing), people will get a error with
pawn Code:
TextDrawSetString(Time,string);
Change it to
pawn Code:
TextDrawSetString(Servt,string);
and also nice FS
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)