//Forwards
forward Clock(playerid);
//Variables - Arrays
new Text:Textdraw99;
new Text:Textdraw88;
//publics
public Clock(playerid)
{
new string[256];
new string2[256];
new year, month, day;
new hour, minute, second;
getdate(year, month, day);
gettime(hour,minute,second);
new mtext[20];
getdate(year, month, day);
if(month == 1) { mtext = "January"; }
else if(month == 2) { mtext = "February"; }
else if(month == 3) { mtext = "March"; }
else if(month == 4) { mtext = "April"; }
else if(month == 5) { mtext = "May"; }
else if(month == 6) { mtext = "June"; }
else if(month == 7) { mtext = "July"; }
else if(month == 8) { mtext = "August"; }
else if(month == 9) { mtext = "September"; }
else if(month == 10) { mtext = "October"; }
else if(month == 11) { mtext = "November"; }
else if(month == 12) { mtext = "December"; }
format(string, sizeof(string), "%d %s, %d", day, mtext, year);
TextDrawSetString(Text:Textdraw99, string);
format(string2, sizeof(string2), "%d:%d:%d", hour, minute, second);
TextDrawSetString(Text:Textdraw88, string2);
}
public OnGameModeInit()
{
SetTimer("Clock", 1000, 1); // Updates the clock every 1 second
Textdraw99 = TextDrawCreate(450.000000,5.000000, "--");
Textdraw88 = TextDrawCreate(551.000000,23.000000,"--");
TextDrawAlignment(Textdraw99,0);
TextDrawAlignment(Textdraw88,0);
TextDrawBackgroundColor(Textdraw99,0x0000ffff);
TextDrawBackgroundColor(Textdraw88,0x0000ffff);
TextDrawFont(Textdraw99,2);
TextDrawLetterSize(Textdraw99,0.499999,1.500000);
TextDrawFont(Textdraw88,2);
TextDrawLetterSize(Textdraw88,0.399999,2.000000);
TextDrawColor(Textdraw99,0x00ffffff);
TextDrawColor(Textdraw88,0x00ffffff);
TextDrawSetOutline(Textdraw99,1);
TextDrawSetOutline(Textdraw88,1);
TextDrawSetProportional(Textdraw99,1);
TextDrawSetProportional(Textdraw88,1);
TextDrawSetShadow(Textdraw99,1);
TextDrawSetShadow(Textdraw88,1);
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw99);
TextDrawShowForPlayer(playerid, Textdraw88);
return 0;
}
if(month == 1) { mtext = "January"; }
else if(month == 2) { mtext = "February"; }
else if(month == 3) { mtext = "March"; }
else if(month == 4) { mtext = "April"; }
else if(month == 5) { mtext = "May"; }
else if(month == 6) { mtext = "June"; }
else if(month == 7) { mtext = "July"; }
else if(month == 8) { mtext = "August"; }
else if(month == 9) { mtext = "September"; }
else if(month == 10) { mtext = "October"; }
else if(month == 11) { mtext = "November"; }
else if(month == 12) { mtext = "December"; }
switch(month)
{
case 1: mtext = "Enero";
case 2: mtext = "Febrero";
case 3: mtext = "Marzo";
case 4: mtext = "Abril";
case 5: mtext = "Mayo";
case 6: mtext = "Junio";
case 7: mtext = "Julio";
case 8: mtext = "Agosto";
case 9: mtext = "Septiembre";
case 10: mtext = "October"
case 11: mtext = "Noviembre";
case 12: mtext = "Diciembre";
}
pawn Код:
![]() |
forward Clock(playerid);
forward Clock();
public Clock()
{
}
TogglePlayerClock(playerid,0);
public OnPlayerConnect(playerid)
{
TogglePlayerClock(playerid,0);
return 1;
}