[RP] :timeleft Glitch Logout

JayC

Always Learning
Aug 8, 2013
5,504
1,401
So when people log in, they can :Startwork and start getting paid, when they log back in the countdown is still going. I have a proxy, and I even tried taking the proxy off and it doesn't fix the problem.

Login -> :startwork
Logout
timer still counts
Login -> :balance -> shit ton of coins
 

JayC

Always Learning
Aug 8, 2013
5,504
1,401
Here you go :) Thanks in advance for taking the time to look at it Westyy!

Code:
#region :startwork
                    case "startwork":

                        #region cw
                        //games
                        if (Session.CharacterInfo.inCw == true)
                        {
                            Session.SendData(RoomChatComposer.Compose(Actor.Id, "Cannot do this in Color Wars", 0, ChatType.Whisper));
                            return true;
                        }
                        #endregion

                        if (Session.CharacterInfo.Energy < 5)
                        {
                            Session.SendData(RoomChatComposer.Compose(Actor.Id, "You're don't have enough energy to work grab a snack and refresh yourself!", 0, ChatType.Whisper));
                            return true;
                        }

                        if (Session.CharacterInfo.SentHome == 1)
                        {
                            Session.SendData(RoomChatComposer.Compose(Actor.Id, "You cant work, Your manager/supervisor has sent you home!", 0, ChatType.Whisper));
                            return true;
                        }
                        if (Session.CharacterInfo.Working == 1)
                        {
                            Session.SendData(RoomChatComposer.Compose(Actor.Id, "You're already working!", 0, ChatType.Whisper));
                            return true;
                        }
                        if (Session.CharacterInfo.Dead == 1)
                        {
                            Session.SendData(RoomChatComposer.Compose(Actor.Id, "You cant work, You're dead!", 0, ChatType.Whisper));
                            return true;
                        }

                        if (Session.CharacterInfo.Jailed == 1)
                        {
                            Session.SendData(RoomChatComposer.Compose(Actor.Id, "You cant work, You're jailed!", 0, ChatType.Whisper));
                            return true;
                        }
                        using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                        {
                            MySqlClient.SetParameter("groupid", Session.CharacterInfo.GroupID);
                            DataRow Row1 = MySqlClient.ExecuteQueryRow("SELECT * FROM groups_details WHERE id = @groupid");
                            MySqlClient.SetParameter("userid", Session.CharacterInfo.Id);
                            DataRow Row2 = MySqlClient.ExecuteQueryRow("SELECT * FROM users WHERE id = @userid");
                            MySqlClient.SetParameter("groupid", Session.CharacterInfo.GroupID);
                            MySqlClient.SetParameter("rankid", Row2["jobrank"]);
                            DataRow Row3 = MySqlClient.ExecuteQueryRow("SELECT * FROM jobranks WHERE jobid = @groupid AND rankid = @rankid");
                            int room_id = (int)Row1["roomid"];
                            string jobname = (string)Row1["name"] + " " + (string)Row3["name"];
                            string jobfig = (string)Row3["figure_data_" + Session.CharacterInfo.Gender.ToString()];
                            int paytime = (int)Row3["paytime"];

                            if (room_id == Instance.RoomId || room_id == 0)
                            {
                                string figure_update = FigToUniFig(Session.CharacterInfo.Figure) + jobfig;
                                if (jobfig == "")
                                {
                                    figure_update = Session.CharacterInfo.Figure;
                                }
                                if (Session.CharacterInfo.Timer < 1 || Session.CharacterInfo.Timer > paytime)
                                {
                                    Session.CharacterInfo.Timer = paytime;
                                }
                                Instance.BroadcastMessage(UserInfoUpdateComposer.Compose(Actor.Id, figure_update, Session.CharacterInfo.Gender, "[WORKING] " + jobname, Session.CharacterInfo.Score));
                                Instance.BroadcastMessage(RoomChatComposer.Compose(Actor.Id, "*Starts to work*", 0, ChatType.Shout));
                                Session.CharacterInfo.UpdateLearning(MySqlClient, 0);
                                Session.CharacterInfo.UpdateWorking(MySqlClient, 1);
                                Session.CharacterInfo.StartTimer("work", Session);

                            }
                        }
                        return true;
                    #endregion
 

Users who are viewing this thread

Top