Raised This Month: $51 Target: $400
 12% 

[TF2] ScrollingRules


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Zirconium
Member
Join Date: Jul 2011
Plugin ID:
2533
Plugin Version:
1.0.0
Plugin Category:
General Purpose
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
    12 
    Plugin Description:
    Displays the Server Rules to users each xxx seconds or on demand to user who asked for
    Old 08-31-2011 , 16:56   [TF2] ScrollingRules
    Reply With Quote #1

    Description : Displays the Server's Rules to all players each XX seconds, or on demand for the current player when asking for them using !rules or /rules in chat command.

    CVARs :

    scrollingrules_version
    The version of this plugin, don't forget to change it in your existing cfg file when you update the plugin.

    scrollingrules_enabled
    Enables/Disable displaying the scrolling rules. (0 = disabled, 1 = enabled)
    Default 1 = enabled

    scrollingrules_howto
    Enable/Disable the display of "How To" message like "type !rules in chat to view our rules". (0 = disabled, 1 = enabled)
    Default 1 = enabled

    scrollingrules_howto_delay
    Amount of seconds before the "How To" message is shown after map has started.
    Default 20 seconds

    scrollingrules_interval
    Amount of seconds between each "group" of rules scrolling automaticaly in chat.
    Default 300 seconds

    scrollingrules_delay
    Amount of seconds between each rule line scrolling when "on demand".
    Default 0.2 seconds

    scrollingrules_autodelay
    Amount of seconds between each rule line scrolling when "auto scrolling".
    Default 0.5 seconds

    scrollingrules_file File to read the scrolling rules from, located in /translations dir.
    Default: scrollingrulesdata.phrases.txt


    The plugin, by default, reads the 'rules' from translations/scrollingrulesdata.phrases.txt, which has this format:

    Code:
            "Phrases"
            {
                "Rule01"
                {
                    "en"        "{red}This are our Server Rules !"
                }
                "Rule02"
                 {
                     "en"        "{red}Follow them {default}or you'll be {red}kicked {default}from Server"
                 }
                 ....
                 "Rule10"
                 {
                     "en"        "'=================================================="
    ...
             }


    Other language files in
    translations/de/scrollingrulesdata.phrases.txt, for german :

    Code:
            "Phrases"
            {
                "Rule01"
                {
                   "de"       "{red}Dass sind unsere Regeln !"
                }
                 "Rule02"
                 {
                     "de"        "{red}Beobachtet Sie {default}oder sie werden vom Server {red}gekickt"'
                 }
                 ....
                 "Rule10"
                 {
                     "de"        "=================================================="
    ...
             }


    or
    translations/fr/scrollingrulesdata.phrases.txt for french:

    Code:
            "Phrases"
            {
                "Rule01"
                {
                    "fr"        "{red}Voici nos Règles !"
                }
                "Rule02"
                 {
                    "fr"        "{red}Respectez les ou vous serez Kické"
                 }
                 ....
                 "Rule10"
                 {
                     "fr"        "=================================================="
    ...
             }


    or in translations/$lang/scrollingrulesdata.phrases.txt for $lang language where $lang is a language code existing in sourcemod/configs/language.cfg on your server!!!

    For more info about languages and translations look HERE

    Each language file must have the same Sections names inside.

    Keep this file structure or the plugin won't work (sections names HAVE TO CONTAIN THE WORD 'Rule', like 'Rule01' or 'Rule Line 2' etc...) .

    If you have [INC]Colors installed you can use color codes in your rules file by uncommenting the //#define USECOLORS and recompile the plugin at your own. If it's NOT installed DON'T USE COLOR TAGS or it won't give you colored text.

    WARNING
    =======

    With version 0.1.0 [INC]Colors has been be replaced by [INC]Morecolors when enabling USECOLORS you'll need to use sourcemod >= version1.5 to compile it if you start from source.

    Two versions are now included, one with USECOLORS activated and the other without it, so you don't need to compile, just choose your version and rename it to scrollingrules.smx after download.


    Installation :

    Put the scrollingrules.phrases.txt file in your %GAMEDIR%/addons/sourcemod/translations directory, this is used to have translation on "How To" message.

    Put the scrollingrulesdata.phrases.txt file in your %GAMEDIR%/addons/sourcemod/translations directory, this is used as rules KV file and for rules translation.

    Put the scrollingrules.smx file in your %GAMEDIR%/addons/sourcemod/plugins directory.

    The scrollingrules.cfg file in your %GAMEDIR%/cfg/sourcemod directory will be auto-generated because AutoExecConfig(true, "scrollingrules"); is set on plugin start, just edit this file if you want to modifiy default values to yours.


    Changelog
    :

    • 0.0.1
      • Initial version (be indulgent it's my first plugin )
    • 0.0.2
      • Changed to KV file no more rules number limit
    • 0.0.3
      • Fixed some warning coding errors
      • #define USECOLORS is not set as default in .smx version
      • scrollingrules.cfg file is 'auto-generated' if not existing at plugin start
    • 0.0.4
      • Using a translation file for getting rules translated in chat.
    • 0.0.5
      • Fixed index problem in SendToAllMsg when server is empty
    • 0.0.6
      • Fixed warning error "KillTimer" on OnMapStart
    • 0.0.7
      • Using PrintToChat and CPrintToChat translation capabilities
      • Added a scrolllingrules_howto_delay var
      • Added a "Start message" in console when plugin starts
    • 0.0.8
      • Fixed global warnings with "KillTimer"
      • translations files examples are provided without color tags inside
    • 0.0.9
      • Fixed KillTimer warning message on map change.
    • 0.1.0
      • Changed from colors.inc to morecolors.inc and updating for sourcemod 1.5.0. Two versions are now included, one with USECOLORS activated and the other without it, so you don't need to compile, just choose your version and rename it after download.
    • 0.1.1
      • updated for sourcemod 1.8.0. and fixed warning messages concerning FCVAR_PLUGIN.
    • 1.0.0
      • solved {teamcolor} issue in welcome message. Version is now fully functional.

    Screenshots
    Attached Thumbnails
    Click image for larger version

Name:	2011-09-12_00002.jpg
Views:	2748
Size:	10.8 KB
ID:	92551   Click image for larger version

Name:	2011-09-12_00003.jpg
Views:	1955
Size:	10.8 KB
ID:	92552  
    Attached Files
    File Type: txt scrollingrules.phrases.txt (262 Bytes, 1382 views)
    File Type: txt scrollingrulesdata.phrases.txt (1.3 KB, 1491 views)
    File Type: smx scrollingrules_with_usecolors.smx (14.2 KB, 524 views)
    File Type: sp Get Plugin or Get Source (scrollingrules_with_usecolors.sp - 483 views - 11.6 KB)
    File Type: smx scrollingrules_without_usecolors.smx (8.2 KB, 359 views)
    File Type: sp Get Plugin or Get Source (scrollingrules_without_usecolors.sp - 1078 views - 11.4 KB)

    Last edited by Zirconium; 07-04-2017 at 09:01. Reason: Version 1.0.0 released
    Zirconium is offline
    Kjaer
    Senior Member
    Join Date: Oct 2009
    Location: Canada
    Old 08-31-2011 , 17:17   Re: ScrollingRules
    Reply With Quote #2

    Might wanna up the rule max.
    __________________
    If you require server assistance add me!
    Kjaer is offline
    Antithasys
    Moderator
    Join Date: Apr 2008
    Old 08-31-2011 , 17:30   Re: ScrollingRules
    Reply With Quote #3

    The hardcoded array used to display the rules is very odd indeed. While it is necessary to know the name of the translation file, using a scheme would appear appropriate here, and it looks like you already made one.

    "RuleX" can be used. This would make the rule count almost unlimited. Since the phrases file is just a KV file, the number of sections could easily be read into a global variable and all you to append the "RuleX" string to continually get the next rule in a loop. Or something, this is just off the top of my head.
    __________________
    [my plugins]

    When you think about asking a question... consider what have you tried?
    Antithasys is offline
    desynced
    Member
    Join Date: Feb 2010
    Old 08-31-2011 , 23:15   Re: ScrollingRules
    Reply With Quote #4

    Plugin failed to compile! Please try contacting the author.
    desynced is offline
    Zirconium
    Member
    Join Date: Jul 2011
    Old 09-01-2011 , 06:18   Re: ScrollingRules
    Reply With Quote #5

    to desynced which errors did you get ??

    try to comment out the #define USECOLORS maybe you don't have colors.inc in your inc files list.


    to Antithasys :
    Quote:
    Originally Posted by Antithasys View Post
    The hardcoded array used to display the rules is very odd indeed. While it is necessary to know the name of the translation file, using a scheme would appear appropriate here, and it looks like you already made one.
    ermmm sorry m8, but i don't know yet how to use KV file with translations , but i'm working "hard" to learn it .

    Quote:
    Originally Posted by Antithasys View Post
    "RuleX" can be used. This would make the rule count almost unlimited. Since the phrases file is just a KV file, the number of sections could easily be read into a global variable and all you to append the "RuleX" string to continually get the next rule in a loop. Or something, this is just off the top of my head.
    When i solved first point i'll try to do it like you proposed , the point is, the same file is used to "auto scroll" rules and when !rules (sm_rules) is asked by a player !!

    Last edited by Zirconium; 09-01-2011 at 08:49.
    Zirconium is offline
    Antithasys
    Moderator
    Join Date: Apr 2008
    Old 09-01-2011 , 15:38   Re: ScrollingRules
    Reply With Quote #6

    Some suggestions:

    Create a global to get the total number of rules.
    PHP Code:
    //total amount of rules in file.
    //get this from counting kv sections in some function
    new g_iTotalRules 0
    Then when you need to load the rules into the message que, or whatever.
    PHP Code:
    for (new 1<= g_iTotalRulesi++)
    {
        
    decl String:sBuffer[256];
        
    Format(sBuffersizeof(sBuffer), "Rule%i"i);
        
    Format(sBuffersizeof(sBuffer), "%T"sBuffer);
        
    AddMsgToAllQueue(clientsBuffer);

    What the above loop does is append the word 'Rule' with a number that increases... like 1, 2, 3, 4, etc... It then gets the translation for that new string and stores it. Then adds it to the queue. This way you don't need to know the literal translation phrase or the total amount of rules.

    *While I didn't solve all your problems, this should get you going in the right direction.
    __________________
    [my plugins]

    When you think about asking a question... consider what have you tried?
    Antithasys is offline
    Spunkie
    Junior Member
    Join Date: Aug 2011
    Old 09-11-2011 , 03:27   Re: [TF2]ScrollingRules
    Reply With Quote #7

    Would love to get a couple of screenshots or a demo video in your original post. ^_^
    Spunkie is offline
    GunSpeed
    Member
    Join Date: Oct 2010
    Old 09-11-2011 , 14:58   Re: [TF2]ScrollingRules
    Reply With Quote #8

    Used the "Get plugin" file sized 10.4 KB : *Linux*

    L 09/11/2011 - 21:42:09: [SM] Plugin encountered error 4: Invalid parameter or parameter type
    L 09/11/2011 - 21:42:09: [SM] Native "PrintToChat" reported: Language phrase "Welcome_message" not found
    L 09/11/2011 - 21:42:09: [SM] Displaying call stack trace for plugin "scrollingrules.smx":
    L 09/11/2011 - 21:42:09: [SM] [0] Line 161, /home/groups/alliedmodders/forums/files/1/4/7/0/7/7/92007.attach::Timer_HowToMessage()

    Last edited by GunSpeed; 09-11-2011 at 15:00.
    GunSpeed is offline
    Zirconium
    Member
    Join Date: Jul 2011
    Old 09-12-2011 , 03:17   Re: [TF2]ScrollingRules
    Reply With Quote #9

    @Spunkie
    You're right i'll do it asap !!!

    @GunSpeed
    Did you copy scrollingrules.phrases.txt in you translations files directory ?
    There are 2 translations files, one for the "How to" message and a second one for the rules !
    __________________

    Last edited by Zirconium; 09-12-2011 at 03:22.
    Zirconium is offline
    GunSpeed
    Member
    Join Date: Oct 2010
    Old 09-12-2011 , 09:56   Re: [TF2]ScrollingRules
    Reply With Quote #10

    Working, giving it more tests.

    I am getting color codes in barracks {default} ...etc {olive..,green..}
    I didn't un comment anything.

    Checking that file again.

    **EDIT**
    Had to manually remove all barracks and their contents ...

    I get this error when I change the interval :

    scrollingrules_interval 100
    L 09/12/2011 - 221:16: [SM] Native "KillTimer" reported: Invalid timer handle 1720039 (error 3)
    L 09/12/2011 - 221:16: [SM] Displaying call stack trace for plugin "scrollingrules.smx":
    L 09/12/2011 - 221:16: [SM] [0] Line 136, /home/groups/alliedmodders/forums/files/1/4/7/0/7/7/92007.attach::ConVarChange_Interval()

    Last edited by GunSpeed; 09-12-2011 at 15:33. Reason: More testing results
    GunSpeed 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 18:09.


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