Reset Scoreboard - Command

Dec 17, 2017
151
19
Hi Devbest,

at the base of the command :unban x I created the command :resetboard for to reset the wired highscore.
I dwell on this part of the code:
PHP:
using (IQueryAdapter dbClient = MoonEnvironment.GetDatabaseManager().GetQueryReactor())
            {

                dbClient.RunQuery("DELETE FROM `wired_scorebord` WHERE `roomid` = '" + Session.GetHabbo().CurrentRoomId + "'");

The parameters are deleted correctly in the database but are still displayed in the display.
In the display the parameters are deleted only when the emulator is restarted.

How do I solve this problem?
Thanks! :)
@Altercationz
 
May 1, 2015
467
152
You're only updating the score within the database which is why it's not updating until you reset the emulator.
Assuming you're using a version of plus emulator, go into the InteractorScoreboard.cs it resets the score if it is pending a reset.
You can add a method within there and call it up in your command and also delete it from the database at the same time.

I made this for you but I don't have time to test it, but fiddle around with it and make it work for your emulator.

The method should look something like this,

Code:
public void ResetScoreboard(Item Item, bool HasRights)
        {
            if (!HasRights)
            {
                return;
            }

            int ResetValue = 0;
            if (!int.TryParse(Item.ExtraData, out ResetValue))
            {
            }
            if (Item.pendingReset)
            {
                Item.ExtraData = ResetValue.ToString();
                Item.UpdateState();
            }
            else
            {
                return;
            }
        }

Goodluck and that's a good idea for a command.
 
Dec 17, 2017
151
19
You're only updating the score within the database which is why it's not updating until you reset the emulator.
Assuming you're using a version of plus emulator, go into the InteractorScoreboard.cs it resets the score if it is pending a reset.
You can add a method within there and call it up in your command and also delete it from the database at the same time.

I made this for you but I don't have time to test it, but fiddle around with it and make it work for your emulator.

The method should look something like this,

Code:
public void ResetScoreboard(Item Item, bool HasRights)
        {
            if (!HasRights)
            {
                return;
            }

            int ResetValue = 0;
            if (!int.TryParse(Item.ExtraData, out ResetValue))
            {
            }
            if (Item.pendingReset)
            {
                Item.ExtraData = ResetValue.ToString();
                Item.UpdateState();
            }
            else
            {
                return;
            }
        }

Goodluck and that's a good idea for a command.
Thank you very much for the time you spent on the command.
I pasted your code into the InteractorScoreBoard file and it didn't give any problems.
How can I recall it in the command?
 

Users who are viewing this thread

Top