SA-MP Forums Archive
Clock blocked + - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Clock blocked + (/showthread.php?tid=608676)



Clock blocked + - GabiXx - 03.06.2016

I have this
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;
} 
But clock is blocked to 1:06.


Re: Clock blocked + - Vince - 03.06.2016

You're setting the minutes to the month number. This stresses the importance of variable naming. Use proper names instead of one letter variables.