Date = TextDrawCreate(503.500000,4.000000,"--");
TextDrawFont(Date,3);
TextDrawLetterSize(Date,0.499999,1.800000);
TextDrawSetOutline(Date, 1);
TextDrawColor(Date,0xFFFFFFFF);
TextDrawBackgroundColor(Date, 0x000000FF);
SetTimer("settime",1000, true);
Time = TextDrawCreate(546.000000,28.000000,"--");
TextDrawFont(Time,3);
TextDrawLetterSize(Time,0.550000,1.750000);
TextDrawSetOutline(Time, 1);
TextDrawColor(Time,0xFFFFFFFF);
TextDrawBackgroundColor(Time, 0x000000FF);
SetTimer("settime",1000, true);
Date = TextDrawCreate(503.500000,4.000000,"--"); TextDrawFont(Date,3); TextDrawLetterSize(Date,0.499999,1.800000); TextDrawSetOutline(Date, 1); TextDrawColor(Date,0xFFFFFFFF); TextDrawBackgroundColor(Date, 0x000000AA ); SetTimer("settime",1000, true); Time = TextDrawCreate(546.000000,28.000000,"--"); TextDrawFont(Time,3); TextDrawLetterSize(Time,0.550000,1.750000); TextDrawSetOutline(Time, 1); TextDrawColor(Time,0xFFFFFFFF); TextDrawBackgroundColor(Time, 0x000000AA ); SetTimer("settime",1000, true);
new Text:Time, Text:Date;
forward settime(playerid);
public OnGameModeInit()
{
Date = TextDrawCreate(503.500000,4.000000,"--");
TextDrawFont(Date,3);
TextDrawLetterSize(Date,0.499999,1.800000);
TextDrawSetOutline(Date, 1);
TextDrawColor(Date,0xFFFFFFFF);
TextDrawBackgroundColor(Date, 0x000000AA );
SetTimer("settime",1000, true);
Time = TextDrawCreate(546.000000,28.000000,"--");
TextDrawFont(Time,3);
TextDrawLetterSize(Time,0.550000,1.750000);
TextDrawSetOutline(Time, 1);
TextDrawColor(Time,0xFFFFFFFF);
TextDrawBackgroundColor(Time, 0x000000AA );
SetTimer("settime",1000, true);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Time);
TextDrawShowForPlayer(playerid, Date);
StopAudioStreamForPlayer(playerid);
return 1;
}
public settime(playerid)
{
new string[256], year, month, day, hours, minutes;
getdate(year, month, day), gettime(hours, minutes);
format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
TextDrawSetString(Date, string);
format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes);
TextDrawSetString(Time, string);
}
Remove the first SetTimer("settime",1000, true);
About the color, theres 2 things more which you made wrong on your code, first of them you need to hide the clock, sencond is that you have to check the color format of TextDrawBackGroundColor if its RGBA or ARGB, try this and post results. |
new Text:Time, Text:Date;
forward settime(playerid);
public OnGameModeInit()
{
Date = TextDrawCreate(503.500000,4.000000,"--");
TextDrawFont(Date,3);
TextDrawLetterSize(Date,0.499999,1.800000);
TextDrawSetOutline(Date, 1);
TextDrawColor(Date,0xFFFFFFFF);
TextDrawBackgroundColor(Date, 0x000000AA );
Time = TextDrawCreate(546.000000,28.000000,"--");
TextDrawFont(Time,3);
TextDrawLetterSize(Time,0.550000,1.750000);
TextDrawSetOutline(Time, 1);
TextDrawColor(Time,0xFFFFFFFF);
TextDrawBackgroundColor(Time, 0x000000AA );
SetTimer("settime",1000, true);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Time);
TextDrawShowForPlayer(playerid, Date);
StopAudioStreamForPlayer(playerid);
return 1;
}
public settime(playerid)
{
new string[256], year, month, day, hours, minutes;
getdate(year, month, day), gettime(hours, minutes);
format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
TextDrawSetString(Date, string);
format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes);
TextDrawSetString(Time, string);
}
Second is that you have to check the color format of TextDrawBackGroundColor if its RGBA or ARGB |
Date = TextDrawCreate(503.500000, 4.000000,"--");
TextDrawFont(Date,3);
TextDrawLetterSize(Date,0.499999,1.800000);
TextDrawSetOutline(Date, 1);
TextDrawColor(Date,White);
TextDrawBackgroundColor(Date, Black);
Time = TextDrawCreate(546.000000, 28.000000,"--");
TextDrawFont(Time,3);
TextDrawLetterSize(Time,0.550000,1.750000);
TextDrawSetOutline(Time, 1);
TextDrawColor(Time,White);
TextDrawBackgroundColor(Time, Black);
Time = TextDrawCreate(546.000000, 28.000000,"--");
TextDrawFont(Time,3);
TextDrawLetterSize(Time,0.550000,1.750000);
TextDrawSetOutline(Time, 1);
TextDrawColor(Time,White);
TextDrawBackgroundColor(Time, Black);
Date = TextDrawCreate(503.500000, 4.000000,"--");
TextDrawFont(Date,3);
TextDrawLetterSize(Date,0.499999,1.800000);
TextDrawSetOutline(Date, 1);
TextDrawColor(Date,White);
TextDrawBackgroundColor(Date, Black);