Problems Making a 'time loop" -
HeLiOn_PrImE - 27.02.2013
Hey guys. I am trying to make constant night time on my server.
I know it's possible by disabling the player clock and setting an hour, but I need that clock running, because the weather changes more smoothly while it's activated. Otherwise I get an instant weather change, and that's not very nice. Here's what I've tried:
I've set a timer:
Код:
forward timechange();
public OnFilterScriptInit()
{
SetTimer("timechange", 240000, true); //4 minutes in real life, so 4 hours gametime
}
And then I made this function here using foreach from ******:
Код:
public timechange()
{
foreach (new i : Player)
{
SetPlayerTime(i,0,0);
}
}
So after 4 minutes in game, the time should have changed back to 00:00 and start over, but it didn't. Can someone explain why?
I used the normal loop already with the same result.
Re: Problems Making a 'time loop" -
DaRk_RaiN - 27.02.2013
The timers aren't accurate, use the fixes plugin or use y_timers.
Re: Problems Making a 'time loop" -
HeLiOn_PrImE - 27.02.2013
accurate or not, the timer should work somehow. This thing didn't work at all...
Re: Problems Making a 'time loop" -
HeLiOn_PrImE - 27.02.2013
Thx for the reply ******, I was just trying your timer library. Here's what I did:
Код:
#define FILTERSCRIPT
#include <a_samp>
#include <foreach>
#include <YSI\y_timers>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
task RepeatingTimer[60000]()
{
foreach (new i : Player)
{
TogglePlayerClock(i, 1);
SetPlayerTime(i,0,0);
}
return 1;
}
}
public OnFilterScriptExit()
{
foreach (new i : Player)
{
TogglePlayerClock(i, 0);
}
return 1;
}
#else
main()
#endif
When I compile, I get this:
Код:
C:\Users\HeLiOn\Desktop\night24.pwn(12) : error 017: undefined symbol "RepeatingTimer@yT_"
C:\Users\HeLiOn\Desktop\night24.pwn(12) : error 029: invalid expression, assumed zero
C:\Users\HeLiOn\Desktop\night24.pwn(12) : error 017: undefined symbol "RepeatingTimer@yT_"
C:\Users\HeLiOn\Desktop\night24.pwn(12) : fatal error 107: too many error messages on one line
What am I doing wrong here?
Re: Problems Making a 'time loop" -
HeLiOn_PrImE - 27.02.2013
Then how do I make the timer start counting at the script launch?
Re: Problems Making a 'time loop" -
HeLiOn_PrImE - 28.02.2013
Bump...
Re: Problems Making a 'time loop" -
DaRk_RaiN - 28.02.2013
Put it under OnGameModeInIt.
Re: Problems Making a 'time loop" -
HeLiOn_PrImE - 28.02.2013
This is what ****** stated above.
Quote:
Originally Posted by ******
"task" is a function type like "public", so it goes outside other functions.
|
Re: Problems Making a 'time loop" -
DaRk_RaiN - 28.02.2013
I thought you're using a normal timer, anyways try using a normal timer if you still don't understand y timers.
Re: Problems Making a 'time loop" -
HeLiOn_PrImE - 28.02.2013
it didn't work with a normal timer.
I figured out most of the y_timer. I just need to know this last thing...