Raised This Month: $32 Target: $400
 8% 

Menu Based Rules (1.5.1, Updated: 10/29/08)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Plugin ID:
427
Plugin Version:
1.5.1
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    30 
    Plugin Description:
    Menu based rules panel gets displayed to clients on connect, or via console command (sm_showrules)
    Old 06-16-2008 , 00:59   Menu Based Rules (1.5.1, Updated: 10/29/08)
    Reply With Quote #1

    General:

    This plugin now requires a SM 1.1 Snapshot version! Get the proper snapshot for your server here: http://www.sourcemod.net/snapshots.php

    There are many changes, please see the changelog below!

    This is my first plugin! First off, credit to graczu for his original plugin (sm_rules). Someone in his/this thread (http://forums.alliedmods.net/showthread.php?t=60338) put in a request to have the rules automatically appear on connect. I've been wanting to get into writing plugins, so I used his ideas as a basis.

    I took no code from anyone (except some panel stuff from the sourcemod tutorial). Also, the reference site could probably use a good scrubbing down. I was there quite a bit. =/

    Additional Credits to Kigen, I looked at your code to learn various things regarding convar usage, seeing as how I've been using your plugin extensively within our community!

    Info:

    This plugin will automatically display a list of rules in a menu panel to all connecting clients. It also has a command line option for admins to display the rules to an individual user (or group, @all etc..). Clients then have the choice of either agreeing, or disagreeing to the rules and conditions presented to them. If they agree, they recieve a nice message. If they disagree, they get kicked (also with a nice message). This plugin now also supports playing a welcome sound to all connecting clients. The sound will not play on map change.

    Usage:

    sm_showrules <#userid|name>


    Installation:
    • Copy showrules.smx to addons/sourcemod/plugins/
    • Copy showrules.sp to addons/sourcemod/scripting/
    • Copy showrules.phrases.txt to addons/sourcemod/translations/
    • Copy showrulesdata.phrases.txt to addons/sourcemod/translations/
    Configuration:
    • sm_showrules_menutime - How long the rules menu should be displayed. Default: 120 (seconds). NOTE: If the menu dissolves or gets cancelled, the user WILL get kicked after menutime expires! This prevents people from cancelling the menu with another menu, or ignoring it all together.
    • sm_showrules_showonjoin - Display the rules menu automatically when a user connects. Default: 1
    • sm_showrules_showtoadmins - When sm_showrules_showonjoin is true (1), also display rules to admins. Default: 0
    • sm_showrules_expiration - Number of hours before previous terms agreement expires and rules are displayed again. Default: 24
    • sm_showrules_displayattempts - Number of times to attempt to to display the rules menu. (3 second intervals) Default: 20
    • sm_showrules_displayfailurekick - Kick client if the rules cannot be displayed after defined display attempts. Default: 1
    • sm_showrules_showmenuoptions - Display agree/disagree menu options. Setting to false will display a simple 1. Close Window option. Clients will not be kicked. Default: 1
    • sm_showrules_joinsound - Sound file to play to connecting clients. Relative to the sound/ folder. Example: 'welcome.mp3' or 'mysounds/welcome.mp3'.
    The rules are now defined in showrulesdata.phrases.txt! This gives you the ability to have multi-lingual rules! Showrules.ini is deprecated! There are 10 rule lines available. If you don't need 10, simply leave the unused ones blank. Do not REMOVE the unused lines, it will cause errors.

    Custom Admin Menu:

    Code:
    "Commands"
    {
    "PlayerCommands"
     {
      "admin"  "sm_ban"
      "Show Rules"
      {
       "cmd"  "sm_showrules #1"
       "execute" "player"
       "1"
       {
        "type"   "player"
        "method" "name"
        "title"  "Player:"
       }
      }
     }
    }


    Notes:


    You have a MAXIMUM of 511 characters which can be used within the menu panel.

    Changelog:

    Version 1.5.1:

    Change of heart, moved the rules out of showrules.phrases.txt and into showrulesdata.phrases.txt. This way if I update the primary translation file with new entries, you don't have to re-do your rules each time.

    Version 1.5:

    This version now automatically creates a config file in cfg/sourcemod/. Please utilize this file and remove sm_showrules cvars from other config files.

    Added convar sm_showrules_expiration. This plugin now makes use of the clientprefs extension in the SM 1.1 snapshots. When players agree to the rules, a cookie will be stored with a timestamp. The next time they connect, if the time period has been greater than sm_showrules_expiration, the rules will be displayed to them again.

    Added convar sm_showrules_joinsound. This allows you to specify a sound to be played to connecting clients. The sound will not be played on map change.

    sm_showrules_showonmapchange has been deprecated. This cvar will no longer do anything!

    Fixed some bugs in the translations.

    Version 1.3:

    Added log message when clients get kicked.

    Rewrote the command function using ProcessTargetString instead of FindTarget to support multiple targets as well as #userid as a target.

    Added convar sm_showrules_showmenuoptions.
    When set to false, clients will see a simple 1) Close Window option. Since there is no disagree option, clients will not be kicked.

    Added New Translations - If you update to 1.3, you must use the new translations file, sorry! This was a new feature only release, if the 1.2 is working fine for you, there's no reason to upgrade unless you want one of the new features.

    Version 1.2:

    Added extensive code to check for other types of menus before displaying the rules menu. If the client has another menu open, the rules menu will wait patiently for 60 seconds (default) to display it's menu. Additionally, if another mod or plugin opens a window which cancels the rules menu, it will again wait 60 seconds to redisplay the rules menu. These changes should make this plugin 100% friendly with mods such as GunGame, CSSDM, etc, which open menus on team selection and other various locations.

    Added Convar: sm_showrules_displayattempts.
    The menu re-display code is hardcoded using a 3 second repeating timer. This value is the number of times the timer will repeat. The default value is 20, which would be 60 seconds. The reasons a menu can not be displayed are limited. Client timing out, another window already open, or some sort of general client error.

    Added Convar: sm_showrules_displayfailurekick.
    After the repeating timer has hit the maximum number of attempts to display the menu, should we kick the client? Default is yes. If they leave a menu open for 60 seconds, they're either blocking the rules menu, timing out, or afk.


    Version 1.1:

    Added Convar: sm_showrules_showonmapchange.
    Hooked scoreboard on map end. Store a complete list of steam id's currently on the server into an array. When clients reconnect after map change, the connecting client ids are compared to the values within the array to determine if they were on the server previously. If they were, we assume they already agreed to the rules and don't show them the menu again. Obviously, setting this to 1 (true) will continue to display the rules to all clients on map change.

    Fixed a rare issue where PostAdminCheck was returning client not connected error messages. Assume it was due to the timing of clients disconnecting, or timing out. Fixed by issuing a isClientConnected check.

    Known Issues:

    Requires at least Sourcemod 1.0.4

    None with TF2, CS:S, DOD:S

    Various issues with Insurgency mod.

    Additional Comments:

    This has turned into the rules menu on steriods! I really don't see any way to update this with any more features short of bugfixes etc.. If you have any ideas, suggestions, or problems, please post them up. Thanks!

    Thanks to Carn for helping test for errors!

    Thanks to Zuko for providing a polish translation
    Thanks to Mordekay for providing a german translation
    Attached Files
    File Type: txt showrulesdata.phrases.txt (1.2 KB, 3665 views)
    File Type: txt showrules.phrases.txt (1.7 KB, 3312 views)
    File Type: sp Get Plugin or Get Source (showrules.sp - 4584 views - 14.0 KB)
    File Type: zip menubasedrules.zip (16.6 KB, 6627 views)

    Last edited by XARIUS; 11-07-2008 at 10:19. Reason: Added german translation
    XARIUS is offline
     


    Thread Tools
    Display Modes

    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 05:53.


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