Payday problem.
#1

Hey, thanks for reading. Anyways:

I'm now at the point of my script where I want to script the payday system however I just can't figure out how to make a "timer" that goes off like every 22:00, 23:00, 00:00, 01:00 By Real Life Time.

Anybody who can help me with this? I've been searching but haven't found anything that could help me.
Reply
#2

If you clock is normal just get the variables from the clock. Otherwise create this timer

pawn Код:
SetTimer("1hourtimer", 1000*60*60, true);
Reply
#3

Quote:
Originally Posted by [HiC
TheKiller ]
If you clock is normal just get the variables from the clock. Otherwise create this timer

pawn Код:
SetTimer("1hourtimer", 1000*60*60, true);
Will this timer also work like for example: Server starts up at 14:20, will the 1hourtimer then set off at 15:00? (That's what I'm trying to do)
Reply
#4

Quote:
Originally Posted by oliverrud
Quote:
Originally Posted by [HiC
TheKiller ]
If you clock is normal just get the variables from the clock. Otherwise create this timer

pawn Код:
SetTimer("1hourtimer", 1000*60*60, true);
Will this timer also work like for example: Server starts up at 14:20, will the 1hourtimer then set off at 15:00? (That's what I'm trying to do)
Nope.

I'm unsure, but maybe you can use gettime()?
Reply
#5

Been thinking of that myself but I'm quite confused how to make it check it that way.
Reply
#6

You can have it go directly on the hour.
Reply
#7

Mhm could you explain a bit more like give me some more information on how? I don't need all the code for it as I wish to learn, but I need some more help
Reply
#8

You can do a 30 minute timer, and then gettime, if the hour is 15 (or whatever hour you want to give payday in)

however depending on when the server starts up, the minute could be anything and wouldn't be "on the dot"

maybe you would want to do a 1 minute timer, 2 minute, 5 minute etc. Your choice.
Reply
#9

I think I might got a idea with gettime(..) Gonna test it and if I get any errors that I can't fix then I will ask for help
Reply
#10

Here's something:

Код:
new paydaytimer;
forward PayUp();
forward PayTime();
OnGameModeInit:
Код:
paydaytimer = SetTimer("PayUp", 60000, 1);
Код:
public PayUp()
{
	PayTime();
}
Код:
public PayTime()
{
	new string[64];
	new tmphour;
	new tmpminute;
	new tmpsecond;
	gettime(tmphour, tmpminute, tmpsecond);
	FixHour(tmphour);
	tmphour = shifthour;
	if ((tmphour > ghour) || (tmphour == 0 && ghour == 12))
	{
		format(string, sizeof(string), "SERVER: The time is now %d:00 hours",tmphour);
		BroadCast(COLOR_WHITE,string);
		ghour = tmphour;
		PayDay();
		if (realtime)
		{
			SetWorldTime(tmphour);
		}
	}
}
This is pretty much saying... If it's :00, then it gives paycheck. With a timer for 60 minutes, it will activate the paycheck time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)