[FS] Date & Time Textdraw - Real Time - +2GMT
This is my first filter-script it took me about 15 mintues. Here we go.
I hope you guys like it. its my first filter-script.
Shows day, month,year
Shows hour, mintues
Image: https://imgur.com/a/nM61N
Here is the code:
This is my first filter-script it took me about 15 mintues. Here we go.
I hope you guys like it. its my first filter-script.
Shows day, month,year
Shows hour, mintues
Image: https://imgur.com/a/nM61N
Here is the code:
Code:
// Date & Time textdraw by Barnwell.
// Real Time - Date
// If you found any bug don't forget to reply on sa-mp forum.
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
new Text:DateText;
new Text:TimeText;
public OnFilterScriptInit()
{
SetTimer("SetTimeDate",1000,true);
DateText = TextDrawCreate(545.500000, 16.177732, "18/3/2016");
TextDrawLetterSize(DateText, 0.298500, 1.058665);
TextDrawAlignment(DateText, 1);
TextDrawColor(DateText, -1);
TextDrawSetShadow(DateText, 0);
TextDrawSetOutline(DateText, 1);
TextDrawBackgroundColor(DateText, 51);
TextDrawFont(DateText, 2);
TextDrawSetProportional(DateText, 1);
TimeText = TextDrawCreate(556.000000, 28.622150, "19:49");
TextDrawLetterSize(TimeText, 0.329499, 0.977777);
TextDrawAlignment(TimeText, 1);
TextDrawColor(TimeText, -1);
TextDrawSetShadow(TimeText, 0);
TextDrawSetOutline(TimeText, 1);
TextDrawBackgroundColor(TimeText, 51);
TextDrawFont(TimeText, 2);
TextDrawSetProportional(TimeText, 1);
print("\n--------------------------------------");
print(" Date & Time Textdraw with functions by Barnwell");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid,DateText);
TextDrawHideForPlayer(playerid,TimeText);
return 1;
}
forward SetTimeDate();
public SetTimeDate()
{
new string[128],
// You can change the world time like GMT+2 GMT+3, etc
year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
SetWorldTime(hours+2);
format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
TextDrawSetString(DateText, string);
format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes);
TextDrawSetString(TimeText, string);
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,DateText);
TextDrawShowForPlayer(playerid,TimeText);
return 1;
}