Monthly Target: $400 Donations: $140
 35% 

Notices

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


Post New Thread Reply   
 
Thread Tools Display Modes
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:
    132 
    Plugin Description:
    Menu based rules panel gets displayed to clients on connect, or via console command (sm_showrules)
    Old 06-16-2008 , 01: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, 2568 views)
    File Type: txt showrules.phrases.txt (1.7 KB, 2338 views)
    File Type: sp Get Plugin or Get Source (showrules.sp - 2325 views - 14.0 KB)
    File Type: zip menubasedrules.zip (16.6 KB, 5410 views)

    Last edited by XARIUS; 11-07-2008 at 11:19. Reason: Added german translation
    XARIUS is offline
    willy1234x1
    Senior Member
    Join Date: Jun 2008
    Old 06-16-2008 , 10:12   Re: Menu Based Rules
    Reply With Quote #2

    It's pretty good but the Help menu plugin does this and more all with the command !helpmenu. Yours could easily be edited to say what plugins are running etc.
    willy1234x1 is offline
    XARIUS
    SourceMod Donor
    Join Date: May 2008
    Location: Atlanta, GA
    Old 06-16-2008 , 11:54   Re: Menu Based Rules
    Reply With Quote #3

    Quote:
    Originally Posted by willy1234x1 View Post
    It's pretty good but the Help menu plugin does this and more all with the command !helpmenu. Yours could easily be edited to say what plugins are running etc.
    Thanks, however this was written to serve specific needs and purposes. I started writing this before helpmenu was released. HelpMenu does not automatically show the rules to the user on connect (based on looking at the plugin), nor does it require them to agree or disagree to the rules. Additionally an admin cannot show a user the rules forcefully using a command.

    The previous menu based rules plugin has not had an update since September of 07 I believe and there were features that I and a few others wanted to see.

    About showing the plugins, I've considered coming up with something that would indeed show connecting users the "mods" or features that are enabled on the server, however I couldn't come up with a solid way of displaying that information to the user in a useful way. Many plugin names are not terribly descriptive, or what you'd want to display to a user.

    I'll be working on a solid warm-up round timer next to replace the one which is broken/buggy.
    XARIUS is offline
    Carn
    Member
    Join Date: Jun 2008
    Old 07-17-2008 , 13:42   Re: Menu Based Rules
    Reply With Quote #4

    handy plugin thanks, although im having issues with log errors as follows,

    sm 1.0.3 linux/win

    Quote:
    L 07/17/2008 - 17:40:14: [SM] Native "GetClientName" reported: Client 26 is not connected
    L 07/17/2008 - 17:40:14: [SM] Displaying call stack trace for plugin "showrules.smx":
    L 07/17/2008 - 17:40:14: [SM] [0] Line 90, /home/groups/alliedmodders/forums/files/3/7/7/5/1/27729.attach:: PanelHandler()
    any advice?
    Carn is offline
    XARIUS
    SourceMod Donor
    Join Date: May 2008
    Location: Atlanta, GA
    Old 07-18-2008 , 12:59   Re: Menu Based Rules
    Reply With Quote #5

    Quote:
    Originally Posted by Carn View Post
    handy plugin thanks, although im having issues with log errors as follows,

    sm 1.0.3 linux/win



    any advice?
    Are these occuring occasionally or in bulk?

    The places I'm calling this the client should certainly be connected, but I can put in some checks to prevent the error.

    Working on some minor updates which should be ready in about a week, time willing.
    XARIUS is offline
    XARIUS
    SourceMod Donor
    Join Date: May 2008
    Location: Atlanta, GA
    Old 07-18-2008 , 16:58   Re: Menu Based Rules (Updated, v1.1)
    Reply With Quote #6

    Updated to version 1.1. See changelog notes. This should fix the error you were seeing. =)
    XARIUS is offline
    Carn
    Member
    Join Date: Jun 2008
    Old 07-18-2008 , 22:49   Re: Menu Based Rules (Updated, v1.1)
    Reply With Quote #7

    It was every 20 minutes or so, thanks for the update will try it at ince!
    Carn is offline
    Carn
    Member
    Join Date: Jun 2008
    Old 07-19-2008 , 15:00   Re: Menu Based Rules (Updated, v1.1)
    Reply With Quote #8

    This update has definitely helped XARIOUS, but im still getting those errors bud, been running for 24 hours now and i have 7kb of this error on each server. They are quite busy servers and as far as i can tell the error is occuring when the client is at the MOTD screen before theyve gone spec.
    I managed to replicate this error by sitting at the motd on join and sending myself the rules, but it doesnt always replicate, something to do with steam validation period?

    +karma anyway as im willing to live with this, but it would be nice to iron out, maybe a problem with other plugins im running will have to do some testing.
    Carn is offline
    XARIUS
    SourceMod Donor
    Join Date: May 2008
    Location: Atlanta, GA
    Old 07-19-2008 , 15:10   Re: Menu Based Rules (Updated, v1.1)
    Reply With Quote #9

    Let me do some more testing and see if I can't iron this out! Thanks for the feedback.
    XARIUS is offline
    XARIUS
    SourceMod Donor
    Join Date: May 2008
    Location: Atlanta, GA
    Old 07-20-2008 , 15:50   Re: Menu Based Rules (Updated, v1.1)
    Reply With Quote #10

    Okay, I think I've got the errors all ironed out. Version 1.2 is almost ready (in testing). This version has compatiblity with other mods or plugins which display their own menus.

    The rules menu will not cancel their menu, but will wait until no menus are open on the client, then display the rules. Also, if another menu pops up and cancels the rules menu, it also waits to re-display the rules menu until no other menus are present.

    This should make the plugin very compatible and friendly with mods such as GunGame, CSSDM, etc, which have menus that popup on team selection.

    If there's any other small features or bugs anyone has found, please let me know so I can get them into this release.

    Thanks!

    X

    Last edited by XARIUS; 07-20-2008 at 16:00.
    XARIUS is offline
    Reply


    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 14:31.


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