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

[TF2] Weapon Adjuster 0.2 (26/10)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Jindo
AlliedModders Donor
Join Date: May 2009
Location: England, UK
Plugin ID:
1249
Plugin Version:
0.2
Plugin Category:
Fun Stuff
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Alter the levels and quality of weapons.
    Old 10-24-2009 , 10:01   [TF2] Weapon Adjuster 0.2 (26/10)
    Reply With Quote #1

    Weapon Adjuster v0.2

    Description:

    This plugin was in a response to a semi-request in the Scripting Forum. This plugin will set levels and rarities/qualities of weapons (based on slots) by reading a config file.

    Screenshots:

    Purple Flare Gun
    Blue Disguise Kit
    Orange Shotgun
    Purple Jarate

    CVars:

    weaponadjuster_version 0.1 - Version of the plugin.
    wa_configfile configs/wadjust.cfg - Designated location of the config file (if you decide to rename the config or place it in a different file, you will need to adjust this cvar.)
    wa_enable 1 - Enable the plugin.

    Setup:
    Place weaponalter.smx in your sourcemod/plugins folder.
    Place the example wadjust.cfg file in your sourcemod/configs folder, it is recommended that you read the guide below on how to configure this.

    Configuration:

    Once you've placed everything on your server, on restart or map change, you should find that all players' weapons are level 100 and appear with yellow text, even the standard weapons. You're free to change this and add more conditions, as many as you like, I will attempt to demonstrate usage of all possible values here.

    First and most important, max_nodes must be specified at the start for the plugin to know how many nodes/conditions it is checking, here is the example config:

    Code:
    "weapons"
    {
        "max_nodes"            "1"
        "1"
        {
            "level"            "100"
            "rarity"        "3"
        }
    }


    These images roughly represent the outcome of the config.

    max_nodes tells the plugin that there is one node to check, if you leave that alone, but add more nodes, the plugin will ignore them. max_nodes must equal your latest node, and you must not skip any numbers when numbering each node.

    Next, conditionals, these are the conditionals that the plugin will check for:

    PHP Code:
    name_contains // Does the client's name contain what ever is specified here?
    steamid_eq // Does the client's steam ID match this one?
    flags // Does the client have the sufficient admin flags?
    class_eq // Is the client this class?

    /* TO DO
     *
     * map_eq // Are we playing a certain map?
     */ 
    The plugin checks each condition, if it comes across a mismatch, the check is aborted and the weapon is not changed. If you leave out a condition, it will not perform that check (eg: missing out class_eq will mean that any class can qualify for a weapon change)

    These are the other values:

    PHP Code:
    slot // Which slot to change (0 = Primary, 1 = Secondary, 2 = Melee etc I THINK). Use -1 or skip it to change all weapons for a client.
    level // Level to set the weapon. -1 or skip it to leave alone.
    rarity // Quality to set the weapon (Does not allow Community or Valve (7 or 8)). -1 or skip it to leave alone.

    /* TO DO
     *
     * color // as opposed to rarity, specify a valid colour and the equivelant quality id will be used.
     * slotex // as opposed to an index, specify "primary, secondary, melee" etc and the equivelant slot id will be used.
     * hat // Defaults to non-zero, if set to 1, the slot check is ignored and instead the adjustment is made to the client's current hat, if they have one.
     */ 
    Now, the example configuration will set everyone's weapons to level 100 and turn them yellow, let's say I wanted only to give Scouts these weapons, I would need to adjust the condition:

    Code:
    "weapons"
    {
        "max_nodes"            "1"
        "1"
        {
            "class_eq"        "scout"
            "level"            "100"
            "rarity"        "3"
        }
    }
    But maybe I just want to change it for my members of my clan? No problem at all:

    Code:
    "weapons"
    {
        "max_nodes"            "1"
        "1"
        {
            "name_contains"        "-KJ-"
            "class_eq"        "scout"
            "level"            "100"
            "rarity"        "3"
        }
    }


    Perhaps I want to give Soldier's a different colour for their Rocket Launchers specifically, whilst still allowing Scouts in -KJ- to have yellow Scatterguns, I'd need to add a new node, and I'd need to adjust max_nodes to support this:

    Code:
    "weapons"
    {
        "max_nodes"            "2"
        "1"
        {
            "name_contains"        "-KJ-"
            "class_eq"        "scout"
            "level"            "100"
            "rarity"        "3"
        }
        "2"
        {
            "slot"            "0"
            "class_eq"        "soldier"
            "level"            "100"
            "rarity"        "6"
        }
    }


    Finally, my dearest admins want Blue named weapons, I've added the flags feature to allow people to target admins/donators/whoever you have in your community very easily, as seen below:

    Code:
    "weapons"
    {
        "max_nodes"            "3"
        "1"
        {
            "name_contains"        "-KJ-"
            "class_eq"        "scout"
            "level"            "100"
            "rarity"        "3"
        }
        "2"
        {
            "slot"            "0"
            "class_eq"        "soldier"
            "level"            "100"
            "rarity"        "6"
        }
        "3"
        {
            "slot"            "2"
            "flags"            "z"
            "rarity"        "4"
        }
    }


    Final example: I adore my Flare Gun but would love to make it look even more awesome, without adjusting everyone else's Flare Gun!

    Code:
    "weapons"
    {
        "max_nodes"            "1"
        "1"
        {
            "steamid_eq"        "STEAM_0:1:14783567"
            "class_eq"        "pyro"
            "slot"            "1"
            "level"            "100"
            "rarity"        "5"
        }
    }


    Rarity Index Numbers:


    Code:
    1 = Olive
    2 = Dark Green
    3 = Yellow (Unique Unlocks)
    4 = Blue
    5 = Purple
    6 = Orange
    If there is any other part of configuration that you're unsure of, feel free to ask and I'll do my best to explain it and perhaps add it to this guide.

    ---

    Commands:
    • wa_reload - Reloads the config.
    • wa_setweapon <client> <slot> <level> <rarity> - Set a player's or players' weapon.
    • wa_setweapons <client> <level> <rarity> - Set a player's or players' weapons.
    • wa_unsetweapons <client> - Reset a player's manually set weapons.
    • wa_hideinfo <client> <slot> - Hide the inspect bar for a weapon.
    The set/unset weapon commands above override the config, so if an admin gives themself a level 100 orange wrench with the config, and then sets it to level 0 in-game, it should stay like that for the remainder of the map.

    ---

    Version History:

    0.2
    • Added translation support
    • Added wa_setweapon, wa_setweapons, wa_unsetweapons and wa_hideinfo, to allow admins to control peoples' weapon details in-game.

    0.1
    • Public Release

    TO DO

    • Commands to adjust/hide/reset a player's or players' weapon(s).
    • Translations
    • Optional messages to appear to someone when their items have been automatically changed.
    • Fix wa_hideall (as seen commented out in the source files)
    • Allow for admins to add directly to the config while in game.


    ---

    There is plenty to be done to extend on this, for now, it's as simple as adjusting the config and the players that match certain nodes will have their weapons adjusted.

    The plugin hasn't been tested thoroughly yet and so some errors are possible. I'll be fixing improving it over the weekend and more!

    NOTE: The attached .sp file uses the 1.2 compiler, if you're using SM 1.3 and want to ensure maximum compatibility then it is recommended that you download the .zip file.
    Attached Files
    File Type: cfg wadjust.cfg (85 Bytes, 781 views)
    File Type: txt weaponalter.phrases.txt (770 Bytes, 812 views)
    File Type: sp Get Plugin or Get Source (weaponalter.sp - 1641 views - 17.5 KB)
    File Type: zip WeaponAlter.zip (14.2 KB, 752 views)
    __________________

    Last edited by Jindo; 12-27-2009 at 05:01.
    Jindo is offline
    Greg_Sucks
    Member
    Join Date: Jul 2009
    Old 10-24-2009 , 10:14   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #2

    Thank you so much for this! I can't wait to mess around with it. FEAR MY LEVEL TEN GAZILLION OLIVE COLORED WRENCH
    Greg_Sucks is offline
    Jindo
    AlliedModders Donor
    Join Date: May 2009
    Location: England, UK
    Old 10-24-2009 , 10:15   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #3

    Quote:
    Originally Posted by Greg_Sucks View Post
    Thank you so much for this! I can't wait to mess around with it. FEAR MY LEVEL TEN GAZILLION OLIVE COLORED WRENCH
    I should mention that from my findings, any level above 100 defaults to something like 57. Atleast the Olive colour will work!

    EDIT: Accidently left a piece of debugging script in there, removed it, apologies to the 2 people who've just downloaded it.

    Working on an update which will allow for admins to set people's items via a command regardless of the config.
    __________________

    Last edited by Jindo; 10-24-2009 at 10:21.
    Jindo is offline
    rwar
    Junior Member
    Join Date: Oct 2009
    Old 10-24-2009 , 11:25   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #4

    awesome. just installed it on my server level 100 soldier weapons !
    rwar is offline
    Greg_Sucks
    Member
    Join Date: Jul 2009
    Old 10-24-2009 , 12:01   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #5

    BTW, is it possible to have custom titles? Kinda like the Valve weapons (which I know you don't want people imitating), except with titles like "Admin Weapon" or "(Clan Name) Weapon" or whatever?
    Greg_Sucks is offline
    Jindo
    AlliedModders Donor
    Join Date: May 2009
    Location: England, UK
    Old 10-24-2009 , 12:06   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #6

    Quote:
    Originally Posted by Greg_Sucks View Post
    BTW, is it possible to have custom titles? Kinda like the Valve weapons (which I know you don't want people imitating), except with titles like "Admin Weapon" or "(Clan Name) Weapon" or whatever?
    I'm afraid there's no way I can find of editing the weapons' names, it might be possible by editing the CTX files though.
    __________________
    Jindo is offline
    Greg_Sucks
    Member
    Join Date: Jul 2009
    Old 10-24-2009 , 12:09   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #7

    Hmm. I've actually already tried that, and it doesn't work. The client would have to edit their own CTX file. Or their tf_english.txt file.
    Greg_Sucks is offline
    Jindo
    AlliedModders Donor
    Join Date: May 2009
    Location: England, UK
    Old 10-24-2009 , 12:24   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #8

    Then it looks like renaming the weapons won't be possible.

    ---

    I'm nearing a testing phase in 0.2, which will have all of the commands for setting specific players' weapons' levels, quality etc. As well as the ability to hide people's weapon by setting it to the normal quality.

    I'm also adding translations, and I've done my best to make sure that weapons changed manually override the config (So if an admin has set their weapons to level 0, but the config sets them to 100, they will remain at level 0)
    __________________
    Jindo is offline
    rwar
    Junior Member
    Join Date: Oct 2009
    Old 10-24-2009 , 12:50   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #9

    it works great except for one minor issue maybe its just my server but i takes awhile for other people to see the level of what ive killed them with.
    rwar is offline
    noodleboy347
    AlliedModders Donor
    Join Date: Mar 2009
    Old 10-24-2009 , 13:54   Re: [TF2] Weapon Adjuster 0.1 (24/10)
    Reply With Quote #10

    I wrote one for the sm_setweapon command you want. Do you want me to send it to you?

    Also, I just tried it, and it works perfectly!

    Last edited by noodleboy347; 10-24-2009 at 14:02.
    noodleboy347 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 04:39.


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