Clock System little help
#1

I am using a zGaming script and in the game time clock when it shows a single digit number i want a 0 in front of the digit for example game time: 09: 05: 01.Dont know but is this the code?
Код:
forward Clock();
public Clock()
{
    new string[128];
	gettime(thour, tmin, tsec);
	new Day, Month, Year;
	getdate(Year, Month, Day);
	format(string, sizeof(string), "~r~game time: ~w~%d:%d:%d", thour, tmin, tsec);
	TextDrawSetString(TimeTD, string);
	foreach(Player, i)
	{
	    if(IsPlayerLoggedIn(i))
	    {
	        if(!IsAFK[i] && !BusTime[i])
	        {
				Seconds[i] ++;
				if(Seconds[i] == 60)
				{
				    Seconds[i] = 0;
				    PlayerInfo[i][pMinutes] ++;
				    if(PlayerInfo[i][pVIPTemp])
				    {
				    	PlayerInfo[i][pVIPTemp] --;
				    	if(PlayerInfo[i][pVIPTemp] <= 0)
				    	{
				    	    PlayerInfo[i][pVIP] = 0;
				    	    PlayerInfo[i][pVIPDay] = 0;
				    	    PlayerInfo[i][pVIPMonth] = 0;
				    	    PlayerInfo[i][pVIPHour] = 0;
				    	    PlayerInfo[i][pVIPTemp] = 0;
							format(string, sizeof(string), "AdmCmd: %s's temporary Bronze VIP package has expired.", RPN(i));
							SendAdminMessage(COLOR_DARKRED, 1, string);
							Log("logs/makevip.log", string);
							SendClientMessage(i, COLOR_LIGHTBLUE, "Your temporary Bronze VIP packag has expired.");
				    	}
					}
				}
				if(PlayerInfo[i][pVIP])
			    {
			        if(Day >= PlayerInfo[i][pVIPDay] && Month >= PlayerInfo[i][pVIPMonth] && !PlayerInfo[i][pVIPTemp])
			        {
						format(string, sizeof(string), "AdmCmd: %s's %s VIP package has expired.", RPN(i), RPVIPN(i));
						SendAdminMessage(COLOR_DARKRED, 1, string);
						Log("logs/makevip.log", string);
						format(string, sizeof(string), " Your %s VIP package has expired.", RPVIPN(i));
						SendClientMessage(i, COLOR_LIGHTBLUE, string);
						PlayerInfo[i][pVIP] = 0;
			    	    PlayerInfo[i][pVIPDay] = 0;
			    	    PlayerInfo[i][pVIPMonth] = 0;
			    	    PlayerInfo[i][pVIPHour] = 0;
			    	    PlayerInfo[i][pVIPTemp] = 0;
			        }
			    }
			}
	    }
	}
Reply
#2

Hailo?
Reply
#3

You could always try this:
pawn Код:
forward Clock();
public Clock()
{
    new string[128];
    gettime(thour, tmin, tsec);
    new Day, Month, Year;
    getdate(Year, Month, Day);
    if(thour < 10)
    {
        format(string,sizeof(string),"~r~game time: ~w~0%d:%d:%d", thour, tmin, tsec);
    }
    else
    {
        format(string, sizeof(string), "~r~game time: ~w~%d:%d:%d", thour, tmin, tsec);
    }
    TextDrawSetString(TimeTD, string);
    foreach(Player, i)
    {
        if(IsPlayerLoggedIn(i))
        {
            if(!IsAFK[i] && !BusTime[i])
            {
                Seconds[i] ++;
                if(Seconds[i] == 60)
                {
                    Seconds[i] = 0;
                    PlayerInfo[i][pMinutes] ++;
                    if(PlayerInfo[i][pVIPTemp])
                    {
                        PlayerInfo[i][pVIPTemp] --;
                        if(PlayerInfo[i][pVIPTemp] <= 0)
                        {
                            PlayerInfo[i][pVIP] = 0;
                            PlayerInfo[i][pVIPDay] = 0;
                            PlayerInfo[i][pVIPMonth] = 0;
                            PlayerInfo[i][pVIPHour] = 0;
                            PlayerInfo[i][pVIPTemp] = 0;
                            format(string, sizeof(string), "AdmCmd: %s's temporary Bronze VIP package has expired.", RPN(i));
                            SendAdminMessage(COLOR_DARKRED, 1, string);
                            Log("logs/makevip.log", string);
                            SendClientMessage(i, COLOR_LIGHTBLUE, "Your temporary Bronze VIP packag has expired.");
                        }
                    }
                }
                if(PlayerInfo[i][pVIP])
                {
                    if(Day >= PlayerInfo[i][pVIPDay] && Month >= PlayerInfo[i][pVIPMonth] && !PlayerInfo[i][pVIPTemp])
                    {
                        format(string, sizeof(string), "AdmCmd: %s's %s VIP package has expired.", RPN(i), RPVIPN(i));
                        SendAdminMessage(COLOR_DARKRED, 1, string);
                        Log("logs/makevip.log", string);
                        format(string, sizeof(string), " Your %s VIP package has expired.", RPVIPN(i));
                        SendClientMessage(i, COLOR_LIGHTBLUE, string);
                        PlayerInfo[i][pVIP] = 0;
                        PlayerInfo[i][pVIPDay] = 0;
                        PlayerInfo[i][pVIPMonth] = 0;
                        PlayerInfo[i][pVIPHour] = 0;
                        PlayerInfo[i][pVIPTemp] = 0;
                    }
                }
            }
        }
    }
Reply
#4

Hello Imperor:
I think it isn`t the best methode ... but it works

Код:
	new tmin_string[5];

	if(tmin<10) {format(tmin_string,sizeof(tmin_string),"0%d",tmin);}
	else {format(tmin_string,sizeof(tmin_string),"%d",tmin);}

	printf("%d.%d.%d - %d:%s:%d", Day, Month, Year, thour, tmin_string, tsec);
Greetz
~ Kevin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)