PHP Code:
#include <a_samp>
#define FILTERSCRIPT
new Text:Time, Text:Date;
forward settime(playerid);
public OnFilterScriptInit()
{
SetTimer("settime",1000,true);
Date = TextDrawCreate(561.000000, 21.000000,"--");
TextDrawBackgroundColor(Date, 255);
TextDrawFont(Date, 3);
TextDrawLetterSize(Date, 0.340000, 1.700000);
TextDrawColor(Date, -7601921);
TextDrawSetOutline(Date, 0);
TextDrawSetProportional(Date, 1);
TextDrawSetShadow(Date, 1);
Time = TextDrawCreate(555.000000, 2.000000,"--");
TextDrawBackgroundColor(Time, 255);
TextDrawFont(Time, 3);
TextDrawLetterSize(Time, 0.470000, 2.299999);
TextDrawColor(Time, -1);
TextDrawSetOutline(Time, 0);
TextDrawSetProportional(Time, 1);
TextDrawSetShadow(Time, 1);
SetTimer("settime",1000,true);
return 1;
}
public OnFilterScriptExit()
{
//=============================================================================
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
return 1;
}
public settime(playerid)
{
new string[256],year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
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:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
TextDrawSetString(Time, string);
}
בדקתי, וזה גם עובד לפי השעה המועדכנת.