Quote:
Originally Posted by xellios
I made a npc but its supposed to teleport you to a map only if its between 16:00 and 17:00 how can i do this?
Second question :
I want him to only let in 50 people how can i do that too?
Thanks for your help and time,
Xellios
|
The "easiest" and most efficient way to do it would be to use the DateTime structure provided by microsoft. You can check if it's in between that time, by doing the following,
Code:
int Hours = DateTime.Now.Hour;
if (Hours >= 16 && Hours <= 17)
{
// ... What to do if it's inbetween this time period
}
else
{
// ... What to do if it is not within the 16h - 17h time period.
}
As for limiting 50 people coming in, you'll need a static-variable, i.e.
Code:
public const int LimitEnter = 50;
public static int PeopleEntered = 0;
And then simply increment (add one) that number everytime someone enters the map through your npc.
If you wish to limit it so only 50 people are on the map, you'll need to increment the variable if someone logs into that map, decrement it (subtract one) if someone leaves that map as well.