Sunrise and Sunset - 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: Sunrise and Sunset (
/showthread.php?tid=548551)
Sunrise and Sunset -
bogdyutzu - 30.11.2014
It is possible to simulate daylight and depending on the real winter time and summer time?
Winter sun sets earlier than summer.
Its possible this in game?
Re: Sunrise and Sunset -
PowerPC603 - 30.11.2014
You may be able to put a textdraw over the default time-readout.
That way you can set the time to sunset to make it dark, while you display the time when it's not sunset yet.
Re: Sunrise and Sunset -
AnthonyTimmers - 30.11.2014
Make a script that sets daylight at TIME. Make this TIME change depending on winter/summer time.
You could use
https://sampwiki.blast.hk/wiki/Getdate
To calculate the TIME variable.
+Rep if I helped you
Re: Sunrise and Sunset -
bogdyutzu - 30.11.2014
And how I can make TIME change depending winter/summer time? Because in San Andreas is summer daylight.
I need some algorithms to make this.
Re: Sunrise and Sunset -
AnthonyTimmers - 30.11.2014
Quote:
Originally Posted by bogdyutzu
And how I can make TIME change depending winter/summer time? Because in San Andreas is summer daylight.
I need some algorithms to make this.
|
Well, for example, you could do it like this (purely example, idk the real light times xD)
Get the date and determine if it's winter or summer with
https://sampwiki.blast.hk/wiki/Getdate
|
v
Every hour check what time it is with
https://sampwiki.blast.hk/wiki/Gettime
|
v
if it's winter and it's 7 pm -> make it nighttime
if it's summer and it's 9 pm -> make it nighttime
That is assuming you want your to have weather according to the real world time.
Re: Sunrise and Sunset -
bogdyutzu - 30.11.2014
I want that daylight change smoothly.
This is what I tried:
PHP код:
GetWinterSummerDay(&hour)
{
new
__y,
__m,
__d;
getdate(__y, __m, __d);
hour += (1 <= __m <= 6) ? (6-__m) : (__m-6);
return true;
}
Every month night increases or decreases with 1 hour. So I add to current time some hours depending on month.
But the problem is that morning light is wrong.
Re: Sunrise and Sunset -
bogdyutzu - 01.12.2014
Any idea?