Clock in Create3DTextLabel
#1

I want to put clock in Create3DTextLabel, but does not work

Код:
new string11[256],year,month,day;
		new string21[256],hours,minutes,seconds;
        getdate(year, month, day), gettime(hours, minutes, seconds);
        format(string11, sizeof(string11), "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
        Create3DTextLabel(string11, 0xFFFF00FF, 2047.7760,1916.2606,16.2052, 25.0, 0, 1);
        format(string21, sizeof(string21), "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
        Create3DTextLabel(string21, 0xFFFF00FF, 2047.7760,1916.2606,16.4052, 25.0, 0, 1);
Sorry for bad English!
Reply
#2

pawn Код:
new str[11],year,month,day, hours, minutes, seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(str, sizeof(str), "%02d/%02d/%04d", day, month, year);
Create3DTextLabel(str, 0xFFFF00FF, 2047.7760,1916.2606,16.2052, 25.0, 0, 1);
format(str, sizeof(str), "%02d:%02d:%02d", hours, minutes, seconds);
Create3DTextLabel(str, 0xFFFF00FF, 2047.7760,1916.2606,16.4052, 25.0, 0, 1);
Reply
#3

I will just give u an alternative that will display the clock over players health and armour during the time they are connected. If u want, you are welcome. This is taken from a filterscript by "RedFusion", props to him.
If u decide to add it, just watch out that the braces go where they should.


TOP:
Код:
#include <a_samp>
new Hour, Minute, timestring[6];
new Text:timetext;//The textdraw
new Ztimer;//Timer ID.
OnGameModeInit
Код:
Hour = 12;
Minute = 00;
Ztimer = SetTimer("timeupdate",1000,true);
timetext = TextDrawCreate(547.000000, 23.000000, "00:00");
TextDrawBackgroundColor(timetext, 255);
TextDrawFont(timetext, 3);
TextDrawLetterSize(timetext, 0.599999, 2.100000);
TextDrawColor(timetext, -1);
TextDrawSetOutline(timetext, 1);
TextDrawSetProportional(timetext, 1);
OnGameModeExit
Код:
   
    TextDrawDestroy(timetext);
    KillTimer(Ztimer);
WHEREVER U WANT:
Код:
forward timeupdate();
public timeupdate()
{
    Minute += 01;
    if(Minute == 60 && Hour < 24) Hour += 01, Minute = 00;
    if(Hour == 24 && Minute == 00) Hour = 00, Minute = 00;
    format(timestring, sizeof(timestring), "%02d:%02d", Hour, Minute);
    TextDrawSetString(timetext,timestring);
    TextDrawShowForAll(timetext);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SetPlayerTime(i,Hour,Minute);
    }
}
Reply
#4

I do not want put clock in textdraw.

This is not work:
Код:
new str[11],year,month,day, hours, minutes, seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(str, sizeof(str), "%02d/%02d/%04d", day, month, year);
Create3DTextLabel(str, 0xFFFF00FF, 2047.7760,1916.2606,16.2052, 25.0, 0, 1);
format(str, sizeof(str), "%02d:%02d:%02d", hours, minutes, seconds);
Create3DTextLabel(str, 0xFFFF00FF, 2047.7760,1916.2606,16.4052, 25.0, 0, 1);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)