restet lottery

10/13/2011 21:45 abdeen#1
hello there , i tried to make its reset the lottery

so i created this code

PHP Code:
                    #region restart lottery
                    
try
                    {

                        if (
Now.Hour == 23 && Now.Minute == 55 && Now.Second == 00)
                        {

                            
ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message(" Server will restart in 5 minutes , Do not sign up for the arena now, save all your data and log out game"System.Drawing.Color.OrangeNetwork.GamePackets.Message.Center), ServerBase.Kernel.GamePool.Values);
                            {
                                
System.Threading.Thread.Sleep(60000);
                                
ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message(" Server will restart in 4 minutes , Do not sign up for the arena now, save all your data and log out game"System.Drawing.Color.OrangeNetwork.GamePackets.Message.Center), ServerBase.Kernel.GamePool.Values);
                                
System.Threading.Thread.Sleep(60000);
                                
ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message(" Server will restart in 3 minutes , Do not sign up for the arena now, save all your data and log out game"System.Drawing.Color.OrangeNetwork.GamePackets.Message.Center), ServerBase.Kernel.GamePool.Values);
                                
System.Threading.Thread.Sleep(60000);
                                
ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message(" Server will restart in 2 minutes , Do not sign up for the arena now, save all your data and log out game"System.Drawing.Color.OrangeNetwork.GamePackets.Message.Center), ServerBase.Kernel.GamePool.Values);
                                
System.Threading.Thread.Sleep(60000);
                                
ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message(" Server will restart in 1 minutes , Do not sign up for the arena now, save all your data and log out game "System.Drawing.Color.OrangeNetwork.GamePackets.Message.Center), ServerBase.Kernel.GamePool.Values);
                                
System.Threading.Thread.Sleep(30000);
                                
ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message(" Server will restart in 30 Seconds , Do not sign up for the arena now, save all your data and log out game "System.Drawing.Color.OrangeNetwork.GamePackets.Message.Center), ServerBase.Kernel.GamePool.Values);
                                
System.Threading.Thread.Sleep(30000);
                                foreach (
Client.GameState clients2 in ServerBase.Kernel.GamePool.Values)
                                {
                                    
Database.PkWarEvent.QQ(clients2);
                                    
Database.EntityTable.ResetLottery2(clients2);
                                    
Database.EntityTable.ResetLottery(clients2);
                                    
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
                                    
cmd.Update("entities").Set("LotteryEntries"0).Where("restart"1).Execute();
                                    
CommandsAI("@save");
                                    
CommandsAI("@restart");
                                    
// ServerStuff.Closed = true;

                                    
Conquer_Online_Server.Game.ConquerStructures.PlayersVot Vot = new Conquer_Online_Server.Game.ConquerStructures.PlayersVot();
                                    
Vot.AdressIp clients2.Account.IP;
                                    
Vot.Uid clients2.Entity.UID;
                                    
Kernel.VotePool.Remove(Vot.AdressIp);
                                    
Kernel.VotePoolUid.Remove(Vot.Uid);
                                    
Database.EntityTable.DeletVotes(Vot);
                                }
                            }
                        }
                    }
                    catch { }
                    
//return;
                    #endregion 

but didn't worked


any help ?
10/13/2011 23:27 DontSpeakToMe#2
how it didn't work explane you problom
10/14/2011 00:16 abdeen#3
Quote:
Originally Posted by DontSpeakToMe View Post
how it didn't work explane you problom
i tried to make its reset the lottery

so i created this code , but its didnt work

i mean when you change the time and go to lady lucky , she is telling you you already joined 10 times :(
10/14/2011 00:20 pro4never#4
Does this code actually run?

Eg: Does it actually do the whole "server is restarting" message at midnight


If so then I'd look into how your storing and resetting lottery plays.

Personally I wouldn't use a 'reset at midnight' type system... it makes it so that I can play 10 times at 12:50 and another 10 times 10 minutes later...

I'd do a per user reset system so that basically 24 hours after my 'first' lotto play it will reset my lotto uses. This way if I use lotto once at 11:00AM at 11:00AM the next day it will reset... if I then play lotto 9 more times at 10:50AM the next day my reset is still in 10 minutes. The 'reset time' just needs MINOR logic to keep it from causing issues.

IE: if I play lotto and my lotto count == 0 i set my lotto reset to 24 hours from now. When that time expires it will reset my count to 0 regardless of if it's reached 10 yet or not.
10/14/2011 01:02 abdeen#5
Quote:
Originally Posted by pro4never View Post
Does this code actually run?

Eg: Does it actually do the whole "server is restarting" message at midnight


If so then I'd look into how your storing and resetting lottery plays.

Personally I wouldn't use a 'reset at midnight' type system... it makes it so that I can play 10 times at 12:50 and another 10 times 10 minutes later...

I'd do a per user reset system so that basically 24 hours after my 'first' lotto play it will reset my lotto uses. This way if I use lotto once at 11:00AM at 11:00AM the next day it will reset... if I then play lotto 9 more times at 10:50AM the next day my reset is still in 10 minutes. The 'reset time' just needs MINOR logic to keep it from causing issues.

IE: if I play lotto and my lotto count == 0 i set my lotto reset to 24 hours from now. When that time expires it will reset my count to 0 regardless of if it's reached 10 yet or not.

i agree with , it shall reset its self when its become 12.00 midnight , but its doesn't , so i have to do anything to fix this issue , so i tried this code , and about you can play 10 times when it 11-55 ,if you recheck the code you will know i coded it to reset the lottery entries before its restart with less than 1 second .

so any help ?? :rolleyes:
10/14/2011 01:48 DontSpeakToMe#6
make sure that the code is in EntityTable.cs and if still don't work try to make
reset lottery code alone but make sure that the server restart and reset lottery
are not the same time
10/14/2011 01:57 abdeen#7
Quote:
Originally Posted by DontSpeakToMe View Post
make sure that the code is in EntityTable.cs and if still don't work try to make
reset lottery code alone but make sure that the server restart and reset lottery
are not the same time
as you see my code is making reset by MYSQL commands then restart , how to check code in intity table ?
10/14/2011 02:21 DontSpeakToMe#8
i mean check you EntityTable by see if there is reset lottery
look at my code in EntityTable
Code:
   public static void ResetLottery(Client.GameState client)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
            cmd.Update("entities").Set("LotteryEntries", 0).Where("UID", client.Entity.UID).Execute();
        }
10/14/2011 02:25 abdeen#9
Quote:
Originally Posted by DontSpeakToMe View Post
i mean check you EntityTable by see if there is reset lottery
look at my code in EntityTable
Code:
   public static void ResetLottery(Client.GameState client)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
            cmd.Update("entities").Set("LotteryEntries", 0).Where("UID", client.Entity.UID).Execute();
        }
yes

PHP Code:
        public static void ResetLottery(Client.GameState client)
        {
            
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
            
cmd.Update("entities").Set("LotteryEntries"0).Where("UID"client.Entity.UID).Execute();
        }
        public static 
void ResetLottery2(Client.GameState client)
        {
            
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
            
cmd.Update("entities").Set("LotteryEntries2"0).Where("UID"client.Entity.UID).Execute();
        }
        public static 
void ResetExpball(Client.GameState client)
        {
            
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
            
cmd.Update("entities").Set("ExpBalls"0).Where("UID"client.Entity.UID).Execute();
        } 

Exp balls working correctly , but the lottery isn't