Jump to content

/rules force

Pending 0.1.4

ffriozi
ffriozi

Posted (edited)

Hello, its possible to force the rules again for a specific player?

thanks for the plugin.

Edited by ffriozi
IIIaKa

Posted

@ffriozi
Hello, at the moment, there is only the option to request consent from all players at once.
However, I will definitely try to add the ability to request consent from a specified player. Thank you for the suggestion.

  • Like 1
ffriozi

Posted

H

On 10/31/2024 at 11:44 AM, IIIaKa said:

@ffriozi
Hello, at the moment, there is only the option to request consent from all players at once.
However, I will definitely try to add the ability to request consent from a specified player. Thank you for the suggestion.

Hello, I ended up making some crude modifications, but the result was close to what I expected. In this case, I created a /rulesagain command that displays the rules panel again without checking if the player has already read it before. I'll share the code in case you want to implement it and improve it. Thank you!

 

// after ShowRules
private void ShowRulesAlways(BasePlayer player)
        {
            if (!_storedData.PlayersData.TryGetValue(player.UserIDString, out var playerData) || (!_config.EveryTime && playerData.LastAgree > _lastUpdate)) ;
            
            DestroyPanel(player);
            CuiHelper.AddUi(player, _cached_MainPanel);
            CuiHelper.AddUi(player, _cached_PanelSubElements
                .Replace(Placeholders_TitleText, lang.GetMessage("PanelTitle", this, player.UserIDString))
                .Replace(Placeholders_TitleSubText, string.Format(lang.GetMessage("PanelLastUpdate", this, player.UserIDString), lang.GetMessage(_lastUpdate.ToString("MMMM"), this, player.UserIDString), _lastUpdate.Day, _lastUpdate.Year))
                .Replace(Placeholders_DeclineBtnText, $"{lang.GetMessage("BtnDecline", this, player.UserIDString)}{(_config.RejectionsToBan > 0 ? string.Format($"({_config.RejectionsToBan - playerData.Declines})") : string.Empty)}")
                .Replace(Placeholders_AcceptBtnText, lang.GetMessage("BtnAccept", this, player.UserIDString)));
            
            _awaitingPlayers.Add(player.UserIDString, null);
            if (_awaitingPlayers.Count == 1)
            DrawContent(player, playerData);

        }



//AddCovalenceCommand
private void Init()
{
    AddCovalenceCommand("rulesagain", nameof(RulesShowAlways_Command)); // Novo comando
}



// commands section
private void RulesShowAlways_Command(IPlayer player, string command, string[] args)
{
    if (player.Object is BasePlayer basePlayer)
    {
        ShowRulesAlways(basePlayer);
        player.Reply("Regras sendo exibidas.");
    }
}

 

1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.3k

Files Sold

Total number of files sold.

2m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.