Repairing Auto invite System

09/30/2011 13:48 shadowman123#1
i wanted to make Auto invite in my server so it would be better And i used that Code

Code:
if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && (DateTime.Now.Hour == 15 && DateTime.Now.Minute <= 59))
            {
                client.OnMessageBoxOK = delegate
                {
                    Network.GamePackets.Data data = new Network.GamePackets.Data(true);
                    data.UID = client.Entity.UID;
                    data.ID = Network.GamePackets.Data.OpenCustom;
                    data.dwParam = Network.GamePackets.Data.CustomCommands.Minimize;
                    client.Send(data);
                    client.Entity.Teleport(1002, 436, 240);
                };
                client.Send(new NpcReply(NpcReply.MessageBox, "Weekly Pk Tournament Starts Now.Would you like to join ?"));
            }
But it doesnt work when the right time come it doesnt Appear but when i loging in that Time it appears what can i do to Avoid this or what makes it like that ...i need the invitation Sent to every online player when right time come not appear just for those who loggin in the right time
09/30/2011 13:56 BaussHacker#2
Make a timer or a thread.
09/30/2011 14:09 shadowman123#3
Could u gimme an exmaple for that ..But till now i dont know what caused that or even the problem in that Code
09/30/2011 16:53 Spirited#4
I'm pretty sure that I answered this before on another thread...
use the search box next time...

You need to put it on a new System.Threading.Thread and use a foreach statement with the client pool as it's condition. If you don't understand what I'm saying, then you should look it up on Google instead of bugging us. You might actually learn something.
09/30/2011 16:53 DontSpeakToMe#5
you must make all the code like you did try to make the Auto invite alone and the time alone

Quote:
Originally Posted by Fаng View Post
I'm pretty sure that I answered this before on another thread...
use the search box next time...

You need to put it on a new System.Threading.Thread and use a foreach statement with the client pool as it's condition. If you don't understand what I'm saying, then you should look it up on Google instead of bugging us. You might actually learn something.
i think you wrong if you want to make it you put time code in Program.cs
and its very easy and simple
09/30/2011 17:05 BaussHacker#6
Quote:
Originally Posted by DontSpeakToMe View Post
you must make all the code like you did try to make the Auto invite alone and the time alone



i think you wrong if you want to make it you put time code in Program.cs
and its very easy and simple
Wtf are you talking about?
09/30/2011 17:15 DontSpeakToMe#7
Quote:
Originally Posted by BaussHacker View Post
Wtf are you talking about?
i make Auto invite like this and its working fully
this Auto invite
Code:
        public static void SendInvitation()
        {
            Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
            foreach (Client.GameState clientss in client)
            {
                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The Guildwar has Started! You Wana Join?");
                npc.OptionID = 249;
                clientss.Send(npc.ToArray());
            }
        }
this time code
Code:
        if (Now.DayOfWeek == DayOfWeek.Sunday)
                {
                    if (Now.Hour == 19 && Now.Minute == 25)
                        Game.ConquerStructures.Society.GuildWar.SendInvitation();
                }
:rtfm:
09/30/2011 17:18 Spirited#8
Quote:
Originally Posted by DontSpeakToMe View Post
i make Auto invite like this and its working fully
this Auto invite
Code:
        public static void SendInvitation()
        {
            Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
            foreach (Client.GameState clientss in client)
            {
                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The Guildwar has Started! You Wana Join?");
                npc.OptionID = 249;
                clientss.Send(npc.ToArray());
            }
        }
this time code
Code:
        if (Now.DayOfWeek == DayOfWeek.Sunday)
                {
                    if (Now.Hour == 19 && Now.Second == 25)
                        Game.ConquerStructures.Society.GuildWar.SendInvitation();
                }
:rtfm:
Oh god. I sincerely hope that you're not executing your event thread every second. That would be such a huge waste of resources...
09/30/2011 17:27 BaussHacker#9
I would rather use a boolean than checking current second. It can get executed more than once in that second or it cannot be executed at all, because what if the server is having a bit delay? ;)
09/30/2011 17:27 DontSpeakToMe#10
Quote:
Originally Posted by Fаng View Post
Oh god. I sincerely hope that you're not executing your event thread every second. That would be such a huge waste of resources...
i write wrong code and i fix that

Quote:
Originally Posted by BaussHacker View Post
I would rather use a boolean than checking current second. It can get executed more than once in that second or it cannot be executed at all, because what if the server is having a bit delay? ;)
LoL i sad i write that wrong and i Correct it
09/30/2011 17:37 diedwarrior#11
Quote:
Originally Posted by DontSpeakToMe View Post
i make Auto invite like this and its working fully
this Auto invite
Code:
        public static void SendInvitation()
        {
            Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
            foreach (Client.GameState clientss in client)
            {
                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The Guildwar has Started! You Wana Join?");
                npc.OptionID = 249;
                clientss.Send(npc.ToArray());
            }
        }
this time code
Code:
        if (Now.DayOfWeek == DayOfWeek.Sunday)
                {
                    if (Now.Hour == 19 && Now.Minute == 25)
                        Game.ConquerStructures.Society.GuildWar.SendInvitation();
                }
:rtfm:
that doesnt even send to a place >.<.
09/30/2011 17:44 Spirited#12
[Only registered and activated users can see links. Click Here To Register...]
What.
09/30/2011 17:49 diedwarrior#13
Quote:
Originally Posted by Fаng View Post
[Only registered and activated users can see links. Click Here To Register...]
What.
If you're whatting me, my meaning is it only pops up saying, guild was has started or w/e if you press ok if wont send you to any place, talking about DontSpeakToMe one's.
09/30/2011 18:00 Spirited#14
Quote:
Originally Posted by diedwarrior View Post
If you're whatting me, my meaning is it only pops up saying, guild was has started or w/e if you press ok if wont send you to any place, talking about DontSpeakToMe one's.
I was mostly meaning the entire thread...
but I answered your question. You need a thread that handlers it. If you have an event thread, then use it. If you don't, make a new thread.
09/30/2011 18:04 diedwarrior#15
Quote:
Originally Posted by Fаng View Post
I was mostly meaning the entire thread...
but I answered your question. You need a thread that handlers it. If you have an event thread, then use it. If you don't, make a new thread.
i already got it done in my source with a boolean.