Raised This Month: $ Target: $400
 0% 

[ND] Commander Restrictions - V1.3


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Player 1
Member
Join Date: Apr 2012
Plugin ID:
2936
Plugin Version:
1.3
Plugin Category:
Server Management
Plugin Game:
Nuclear Dawn
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Prevents a player from applying for commander if his level is not between the min and max Cvars.
    Unapprover:
    Reason for Unapproving:
    No response to feedback provided over 1 month ago.
    Old 04-30-2012 , 22:35   [ND] Commander Restrictions - V1.3
    Reply With Quote #1

    This plugin blocks the command "applyforcommander" if the client's level is not between a minimum and maximum. It does not interfere with the promote command from Commander Management.

    Cvars:
    • sm_com_restrictions | Default = 0 | "Enables/Disables ND Commander Restrictions"
    • sm_com_min_level | Default = 1 | "Minimum level allowed to apply for commander."
    • sm_com_max_level | Default = 80 | "Maximum level allowed to apply for commander."
    • sm_com_restrict_time | Default = 60 | "Number of seconds after round start remove restrictions. [0 == Never Remove]" This exists in case no one on [min,max] applies for commander. If set greater than 0, the restrictions will be removed after t seconds.
    • sm_com_min_pop | Default = 10 | Minimum number of real players that must be connected for restrictions to be applied.
    Known Issues:
    • Players must have spawned at least once before they can apply. I don't see any way around this since levels are not loaded until they have spawned.
    ChangeLog:
    1.3 (28 September 2012)
    Lots of minor improvements

    1.2 (29 May 2012)
    Simplified finding players' ranks

    1.1 (18 May 2012):
    Updated max level to 80.
    Added the cvar sm_com_min_pop

    1.0
    Plugin released.
    Special thanks to psychonic for helping me retrieve players' ranks.
    Attached Files
    File Type: sp Get Plugin or Get Source (nd_commander_restrictions.sp - 260 views - 4.3 KB)

    Last edited by Dr. McKay; 10-06-2012 at 16:53. Reason: Feedback given
    Player 1 is offline
    Peace-Maker
    SourceMod Plugin Approver
    Join Date: Aug 2008
    Location: Germany
    Old 05-02-2012 , 19:13   Re: [ND] Commander Restrictions
    Reply With Quote #2

    Nice plugin. You should consider caching the convar handles as calls to FindConVar are expensive. You don't need to tag the function callbacks like "CommandListener:" or any other variable, which already has that tag btw.

    PHP Code:
    public Action:Waiting(Handle:timer) {
        
    spam 0
        CloseHandle
    (Handle:Waiting);

    You can't stop a timer like that. Waiting is a function not a handle to the timer. You just want to return Plugin_Stop;
    Please consider rechecking your tagging as it's kinda strange;)
    __________________
    Peace-Maker is offline
    Player 1
    Member
    Join Date: Apr 2012
    Old 05-02-2012 , 23:12   Re: [ND] Commander Restrictions
    Reply With Quote #3

    Thanks for the response. The way I see it, this plugin isn't to useful at this point in anyway. There are so few new players coming into the game that I don't expect anyone to run this plugin to stop them from commanding. But I'll look into your suggestion and re-upload soon.
    Player 1 is offline
    snelvuur
    Veteran Member
    Join Date: Jun 2008
    Location: Netherlands
    Old 05-04-2012 , 09:40   Re: [ND] Commander Restrictions
    Reply With Quote #4

    All nd players should get a free give-away to get more people to play the game, or a free week of playtime.. during the free weekend it was super, servers full lots of players but after that its been going downhill.
    __________________
    Arguing with a fool only proves there are two
    snelvuur is offline
    Player 1
    Member
    Join Date: Apr 2012
    Old 05-06-2012 , 17:24   Re: [ND] Commander Restrictions
    Reply With Quote #5

    Re-uploaded the source with the suggestions from Peace-Maker.
    Player 1 is offline
    Calystos
    Member
    Join Date: Jan 2011
    Location: Terra
    Old 05-07-2012 , 13:02   Re: [ND] Commander Restrictions
    Reply With Quote #6

    Here's your latest code with an additional feature "minimum player threshold" that'll only enable the restrictions if total number of players is equal or greater than the min threshold.

    Was pondering max threshold too, so the codes partly in there as am heading out an don't have time to remove it.

    Only other diff is to stop confusion I renamed the script to nd_commander_restrictions and appended the scripts name with "[ND] "

    Was a quick hack so not tested yet but should work.
    Attached Files
    File Type: sp Get Plugin or Get Source (nd_commander_restrictions.sp - 267 views - 5.0 KB)

    Last edited by Calystos; 05-07-2012 at 13:03.
    Calystos is offline
    Send a message via ICQ to Calystos Send a message via AIM to Calystos Send a message via MSN to Calystos Send a message via Yahoo to Calystos Send a message via Skype™ to Calystos
    Player 1
    Member
    Join Date: Apr 2012
    Old 05-18-2012 , 11:54   Re: [ND] Commander Restrictions
    Reply With Quote #7

    Good idea Calystos with the minimum pop cvar. I didn't really see any need for the max population cvar, so I removed everything pertaining to that.

    I've updated the first post's change log and source code to reflect recent changes.
    Player 1 is offline
    Peace-Maker
    SourceMod Plugin Approver
    Join Date: Aug 2008
    Location: Germany
    Old 09-06-2012 , 07:15   Re: [ND] Commander Restrictions
    Reply With Quote #8

    That's good - still few things though:
    • Don't set the FCVAR_NOTIFY flag on any other cvar than the _version one, if it's not for a good reason really. It causes the A2S_RULES query to get polluted with uninteresting config stuff.
    • You still don't have to tag things again to the same tag they're already declared with. (HookConVarChange(Handle:g_Cvar_Enable, ConVarChanged:RefreshCvars); - g_Cvar_Enable already is a Handle and RefreshCvars already matches the functag ConvarChanged)
    • You missed the new cMinPop convar in the convarchange hooking.
    • You might want to save the end_restrictions timer handle and close it, if it's still running on round start. Imagine some round restart before the timer runs up.
    __________________
    Peace-Maker is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 10-06-2012 , 16:53   Re: [ND] Commander Restrictions - V1.3
    Reply With Quote #9

    PHP Code:
    RegConsoleCmd("applyforcommander"Command_Apply); 
    Use AddCommandListener instead to hook existing commands.

    PHP Code:
    HookConVarChange(g_Cvar_EnableConVarChanged:RefreshCvars);
        
    HookConVarChange(g_Cvar_MinLvlConVarChanged:RefreshCvars);
        
    HookConVarChange(g_Cvar_MaxLvlConVarChanged:RefreshCvars);
        
    HookConVarChange(g_Cvar_TimerConVarChanged:RefreshCvars); 
    You don't need the ConVarChanged: tags.

    You still forgot to hook convar change on g_Cvar_MinPop.

    PHP Code:
    g_hTimerHandle CreateTimer(Float:cTimerEnd_Restrictions); 
    You don't need a Float: tag here either.

    Besides that, it looks good.
    __________________
    Dr. McKay is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 13:59.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode