PHP код:
#define FILTERSCRIPT
#include <a_samp>
#define SDATE_COL 0x7458C1FF
#define STIME_COL 0x1E90FFFF
new Text:ServerDate;
new Text:ServerTime;
public OnFilterScriptInit()
{
print("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
print(" Sample Clock Filter Script SA:MP by Wiper has successfully loaded.");
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
SetTimer("TimeSet", 1000, true);
ServerDate = TextDrawCreate(544.5, 13.00, "--");
ServerTime = TextDrawCreate(547.5, 25.33, "--");
TextDrawFont(ServerDate, 1);
TextDrawFont(ServerTime, 3);
TextDrawColor(ServerDate, SDATE_COL);
TextDrawColor(ServerTime, STIME_COL);
TextDrawLetterSize(ServerDate, 0.550, 1.414);
TextDrawLetterSize(ServerTime, 0.600, 1.614);
TextDrawSetShadow(ServerDate, 0);
TextDrawSetShadow(ServerTime, 0);
TextDrawSetOutline(ServerDate, 1);
TextDrawSetOutline(ServerTime, 1);
TextDrawShowForAll(ServerDate);
TextDrawShowForAll(ServerTime);
return 1;
}
public OnFilterScriptExit()
{
print("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
print(" Sample Clock Filter Script SA:MP by Wiper unloaded.");
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
TextDrawHideForAll(ServerDate);
TextDrawHideForAll(ServerTime);
TextDrawDestroy(ServerDate);
TextDrawDestroy(ServerTime);
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, ServerDate);
TextDrawShowForPlayer(playerid, ServerTime);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, ServerDate);
TextDrawHideForPlayer(playerid, ServerTime);
return 1;
}
forward TimeSet( );
public TimeSet( )
{
new String[2][12];
new y,m,d,h,mi,s;
new MonthName[12][] =
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
getdate(y,m,d);
gettime(h,mi,s);
format(String[0], 18, "%d %s", d, MonthName[m-1]);
format(String[1], 18, "%02d:%02d", h,m);
TextDrawSetString(ServerDate, String[0]);
TextDrawSetString(ServerTime, String[1]);
return 1;
}
You're setting the minutes to the month number. This stresses the importance of variable naming. Use proper names instead of one letter variables.