PDA

View Full Version : clock problem


POL_george
01/12/2016, 01:02 PM
I tried this
forward Clock();
public Clock()
{
new years, months, days, hours, minutes, seconds, data[128], clock[128];
getdate(years, months, days);
gettime(hours, minutes, seconds);
format(data, 128, "%i/%i/%i", days, minutes, years);
format(clock, 128, "%i:%i:%i", hours, minutes, seconds);
TextDrawSetString(Date, data);
TextDrawSetString(Hour, data);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
TextDrawShowForPlayer(i,Date);
TextDrawShowForPlayer(i,Hour);
}
}
return 1;
}

in OnGameModeInt
//Data
Date = TextDrawCreate(502, 110, "Ora");
TextDrawFont(Date , 3);
TextDrawTextSize(Date, 0.5, 1);
TextDrawColor(Date , 0xFFFFFFFF);
TextDrawSetOutline(Date , 1);
TextDrawSetProportional(Date , 1);
TextDrawSetShadow(Date , 1);
//Ora
Hour = TextDrawCreate(549, 29, "Ora");
TextDrawFont(Hour , 3);
TextDrawTextSize(Hour, 0.5, 1);
TextDrawColor(Hour , 0xFFFFFFFF);
TextDrawSetOutline(Hour , 1);
TextDrawSetProportional(Hour , 1);
TextDrawSetShadow(Hour , 1);

SetTimer("Clock", 100, true);

Why it's not showing up? I have no errors/warning

BrianFaria
01/12/2016, 01:11 PM
Try this

forward Clock();
public Clock()
{
new years, months, days, hours, minutes, seconds, data[128], clock[128];
getdate(years, months, days);
gettime(hours, minutes, seconds);
format(data, 128, "%i/%i/%i", days, minutes, years);
TextDrawSetString(Date, data);
format(clock, 128, "%i:%i:%i", hours, minutes, seconds);
TextDrawSetString(Hour, clock);
return 1;
}


//Data
Date = TextDrawCreate(502, 110, "Ora");
TextDrawFont(Date , 3);
TextDrawTextSize(Date, 0.5, 1);
TextDrawColor(Date , 0xFFFFFFFF);
TextDrawSetOutline(Date , 1);
TextDrawSetProportional(Date , 1);
TextDrawSetShadow(Date , 1);
//Ora
Hour = TextDrawCreate(549, 29, "Ora");
TextDrawFont(Hour , 3);
TextDrawTextSize(Hour, 0.5, 1);
TextDrawColor(Hour , 0xFFFFFFFF);
TextDrawSetOutline(Hour , 1);
TextDrawSetProportional(Hour , 1);
TextDrawSetShadow(Hour , 1);

SetTimer("Clock", 100, true);

Eoussama
01/12/2016, 01:13 PM
Put this code
new years, months, days, hours, minutes, seconds, data[128], clock[128];
getdate(years, months, days);
gettime(hours, minutes, seconds);
format(data, 128, "%i/%i/%i", days, minutes, years);
format(clock, 128, "%i:%i:%i", hours, minutes, seconds);
TextDrawSetString(Date, data);
TextDrawSetString(Hour, data);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
TextDrawShowForPlayer(i,Date);
TextDrawShowForPlayer(i,Hour);
}
}
return 1;
in OnPlayerConnect or OnPlayerSpawn I'm not very experienced in textdraw but if I were you, I would have tried this