Everlast

Member
Hello guys im trying to activate a dungeon entrance by day and hour,ill tryed that:

C#:
public void Activated()
        {
            DayOfWeek wk = DateTime.Today.DayOfWeek;
           
            if (wk == DayOfWeek.Saturday && DateTime.Now.Hour == 22)
            {
                return true;
            }
            if (wk == DayOfWeek.Sunday && DateTime.Now.Hour == 22)
            {
                return false;
            }
        }
Then:

C#:
if (Activated())
            {
            StartTeleport(m);
            return true;
            }
Im learning C# now so im so new,searching around google it says i need to return a value,but dont understand,anyone can help a bit or explain?Ty!
Post automatically merged:

UPDATE
Now script load,i just replace void per bool,so the code is:

C#:
public bool Activated()
        {
            DayOfWeek wk = DateTime.Today.DayOfWeek;
           
            if (wk == DayOfWeek.Saturday && DateTime.Now.Hour == 22)
            {
                return true;
            }
            if (wk == DayOfWeek.Sunday && DateTime.Now.Hour == 22)
            {
                return false;
            }
        return false;
        }
Now just see if its working ty!
I want the teleport is open from sunday at 22 to saturday at 22
 
Last edited:
yeah, void is literally a void you're tossing information into. you can take that info and call another method but you cant use a void method in an if statement.

if (this.Activated)
teleportplayer
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back