SA-MP Forums Archive
[FilterScript] [FS] Basic Clock (UPDATED to v1.3) - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] [FS] Basic Clock (UPDATED to v1.3) (/showthread.php?tid=106723)



[FS] Basic Clock (UPDATED to v1.3) - iron_war_lord - 05.11.2009

Basic Clock v1.3
A simple clock for day and night cycles.
Source: Pastebin
About

Each minute is one r/l second, each hour is one r/l minute.
Day and night cycle comes with each hour, so it looks like 9 o'clock at night if it is 9 o'clock in game.

Fixed
Clock went to 25 hours, not 24 hours (v1.1)
Programming style default string naming (string) conflicted with other strings (v1.3)

Added
/time [hour] changes the hour to [hour], changes the ToD also. (v1.1)
Smoother time changing (v1.2)

AMX:



Re: [FS] Basic Clock (source only) - Zeromanster - 05.11.2009

Nice release.


Re: [FS] Basic Clock (source only) - CracK - 05.11.2009

It's ok, but you could type instead of:
pawn Code:
if(TextZBCMinutes < 10)
    {
      format(TextZBCMinutesString, sizeof(TextZBCMinutesString), "0%i", TextZBCMinutes);
    }
    if(TextZBCMinutes > 10)
    {
      format(TextZBCMinutesString, sizeof(TextZBCMinutesString), "%i", TextZBCMinutes);
    }
    if(TextZBCHours < 10)
    {
      format(TextZBCHoursString, sizeof(TextZBCHoursString), "0%i", TextZBCHours);
    }
    if(TextZBCHours > 10)
    {
      format(TextZBCHoursString, sizeof(TextZBCHoursString), "%i", TextZBCHours);
    }
Simply:
pawn Code:
format(TextZBCMinutesString, sizeof(TextZBCMinutesString), "%02d", TextZBCMinutes);
format(TextZBCHoursString, sizeof(TextZBCHoursString), "%02d", TextZBCHours);



Re: [FS] Basic Clock (source only) - iron_war_lord - 05.11.2009

Oh ok, but what does %02d mean? (Two digits?)


Re: [FS] Basic Clock (source only) - DokerJr - 05.11.2009

this script is only for 0.3a ?


Re: [FS] Basic Clock (source only) - iron_war_lord - 05.11.2009

Quote:
Originally Posted by ■■ DokerJr ■■
this script is only for 0.3a ?
Scripted in 0.3a, haven't tried it in any version lower, but I'm sure it will work with older versions.


Re: [FS] Basic Clock (source only) - Rickyboy30 - 05.11.2009

If we change the time ingame,

So I set it to 2 AM.
Will the clock then change too ?


Re: [FS] Basic Clock (source only) - iron_war_lord - 05.11.2009

Quote:
Originally Posted by Rickyboy30
If we change the time ingame,

So I set it to 2 AM.
Will the clock then change too ?
No, I'm working on that now

Updated, feature added in v1.1


Re: [FS] Basic Clock (source only) - Zeromanster - 06.11.2009

Quote:
Originally Posted by Zinglish
Quote:
Originally Posted by Rickyboy30
If we change the time ingame,

So I set it to 2 AM.
Will the clock then change too ?
No, I'm working on that now

Updated, feature added in v1.1
It's even better now, re-downloaded. Thanks again Zinglish.


UPDATED - iron_war_lord - 10.11.2009

Updated Basic Clock to 1.2
New features:
Very smooth ToD change now

PS:
Times between 5:30 and 6:30 are beautiful...