Raised This Month: $7 Target: $400
 1% 

[TF2Items] Item Designer - Advanced Give Item


Post New Thread Reply   
 
Thread Tools Display Modes
Author
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Plugin ID:
2088
Plugin Version:
1.0.2
Plugin Category:
Technical/Development
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
    63 
    Plugin Description:
    Give custom items on the fly
    Old 11-21-2010 , 16:24   [TF2Items] Item Designer - Advanced Give Item
    Reply With Quote #1

    [TF2Items] Item Designer
    AKA: Advanced Give Item

    Version 1.0.2



    Description:
    This plugin is a hybrid of TF2Items' manager plugin and Give Weapon in that it allows you to give custom items without editing/uploading/reloading a config file.

    I wrote this plugin to make testing attribute settings easier and am releasing it in the hopes that others may find it useful.

    Warning/Note:
    This plugin assumes you know what you are doing. If you feed the command bad data the plugin will try to use it and will crash the server!
    Make sure your command string is valid before running it!

    Requires asherkin's TF2Items extension.

    Commands:
    sm_giveitem - Gives an item
    sm_gi - Same as above

    Command Usage:
    Command Structure:
    sm_gi <client> <item index> <slot> <level> <quality> <preserve attribs 1/0> <hat 1/0> <tf_weapon_classname> <"attributes">
    1. <Client> = target player
    2. <Item index> = item index from items_game.txt
    3. <Slot> = Weapon's slot, primary = 1, secondary = 2, etc. Use -1 for hats.
    4. <Level> = New item level (0-100). -1 for no change.
    5. <Quality> = New item quality. -1 for no change.
    6. <Preserve Attributes> = Keep existing attributes 1/0 (use 0 as I haven't tested 1)
    7. <Hat> = 1/0 - Controls the give method, see below.
    8. <tf_weapon_classname> = "item_class" from items_game.txt Example: tf_weapon_knife or tf_weapon_rocketlauncher
    9. <Attributes> = Same format as tf2items_manager's config file. Eg: "129 ; 10"
    Give methods:
    • Mode 0 will give and equip a weapon immediately and must be used for weapons only.
    • Mode 1 will edit the item as it is equipped and must be used for hats only.
      You must have the hat equipped for the command to do anything.
    • Using weapons with mode 1 or hats with mode 0 will cause crashes!
    Examples:
    • sm_gi @me 298 1 100 -1 0 0 tf_weapon_minigun "129 ; 5"
      Would give you a level 100 Iron Curtain that heals you 5 hp a second
    • sm_gi @me 298 1 100 -1 0 0 tf_weapon_minigun "129 ; 5" "16 ; 2" "37 ; 3"
      Would give you a level 100 Iron Curtain that heals you 5 hp a second, heals you for 2 hp per hit, and has 3 times as much ammo.
    • sm_gi @me 18 1 50 8 0 0 tf_weapon_rocketlauncher "2 ; 100.0" "4 ; 91.0" "6 ; 0.25" "110 ; 500.0" "26 ; 250.0" "31 ; 10.0" "107 ; 3.0" "97 ; 0.4" "134 ; 4.0"
      Would give you a level 50 valve rocket launcher with crazy stats.
    • sm_gi @me 146 -1 69 5 0 1 -1 "134 ; 13"
      Would give me an Unusual level 69 demo pimp hat with valve fire. Assuming I'm a demo with a pimp hat.
    Cvars:
    sm_giveitem_version - Plugin Version
    sm_giveitem_textspew - 1/0 Sets whether to print debugging text (default = on).

    Install Instructions:
    1. Install TF2Items.
    2. Place GiveItem.smx into your addons/sourcemod/plugins/ folder.
    Notes:
    I wrote this mostly over a period of 2 sleepless nights, so if you notice anything goofy in the code, that's why.
    Default admin flag is ROOT.
    If you or someone else inadvertently crashes your server by giving this plugin bad data, do not complain to me!
    Use [TF2] Set Ammo to change ammo values if so desired.

    ToDo:
    • Video
    • Moar examples
    Version History:
    • V1.0.0
      • Initial Release
    • V1.0.1
      • Fixed Errors when using rcon
    • V1.0.2
      • Fixed another error
    43|58

    This uses the tf2items extension, and will not compile on the forum.
    Use the attached smx or compile it yourself.
    Attached Files
    File Type: smx GiveItem.smx (6.7 KB, 12180 views)
    File Type: sp Get Plugin or Get Source (GiveItem.sp - 4717 views - 9.3 KB)
    __________________

    Last edited by DarthNinja; 10-25-2012 at 18:55.
    DarthNinja is offline
    DarthNinja
    SourceMod Plugin Approver
    Join Date: Mar 2009
    Location: PreThinkHook()
    Old 11-21-2010 , 16:29   Re: [TF2Items] Advanced Give Item
    Reply With Quote #2

    ~Reserved
    __________________
    DarthNinja is offline
    DarthNinja
    SourceMod Plugin Approver
    Join Date: Mar 2009
    Location: PreThinkHook()
    Old 11-21-2010 , 16:30   Re: [TF2Items] Advanced Give Item
    Reply With Quote #3

    ~Also Reserved
    __________________
    DarthNinja is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 11-21-2010 , 17:12   Re: [TF2Items] Advanced Give Item
    Reply With Quote #4

    /gi @all 0 1 127 10 1 0 tf_weapon_knife "134 ; 19"
    Crash everything!
    __________________
    Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

    All plugins: Randomizer/GiveWeapon, ModelManager, etc.
    Post in plugin threads with questions.
    Steam is for playing games.
    You will be fed to javalia otherwise.
    Psyduck likes replays.
    FlaminSarge is offline
    Skyrider
    AMX Mod X Beta Tester
    Join Date: May 2005
    Location: Netherlands
    Old 11-23-2010 , 07:30   Re: [TF2Items] Advanced Give Item
    Reply With Quote #5

    Is there anyway to give yourself a hat rather than giving your hat that you own an effect? So far it doesn't work and I can only get myself weapons. I'm not too much familiar with giving items by the way.
    __________________
    Skyrider is offline
    Send a message via AIM to Skyrider Send a message via MSN to Skyrider Send a message via Yahoo to Skyrider
    DarthNinja
    SourceMod Plugin Approver
    Join Date: Mar 2009
    Location: PreThinkHook()
    Old 11-23-2010 , 09:03   Re: [TF2Items] Advanced Give Item
    Reply With Quote #6

    Quote:
    Originally Posted by FF|Skyrider View Post
    Is there anyway to give yourself a hat rather than giving your hat that you own an effect? So far it doesn't work and I can only get myself weapons. I'm not too much familiar with giving items by the way.
    You can "give" a hat using TF2items, however nobody but the equipped player will see it. For this reason I have not implemented that ability in the plugin.

    Your choices are:
    Give a weapon (right away).
    Change a hat the next time you equip your loadout. (The plugin regenerates your loadout right away, so you see the changes immediately.)
    You MUST have the hat equipped to your current class or the command will do nothing.

    As per my examples above:
    Quote:
    sm_gi @me 146 -1 69 5 0 1 -1 "134 ; 13"
    Would give me an Unusual level 69 demo pimp hat with valve fire. Assuming I'm a demo with a pimp hat.
    I must be a demo, and I must have the Pimp hat equipped.
    __________________
    DarthNinja is offline
    Regis
    Member
    Join Date: Sep 2009
    Old 11-23-2010 , 11:09   Re: [TF2Items] Advanced Give Item
    Reply With Quote #7

    Fantastic, much easier to test weapons on the go, now we just need a way to see the weapons when they spawn (where's that workaround I keep hearing about ).
    Regis is offline
    DarthNinja
    SourceMod Plugin Approver
    Join Date: Mar 2009
    Location: PreThinkHook()
    Old 11-23-2010 , 12:29   Re: [TF2Items] Advanced Give Item
    Reply With Quote #8

    Quote:
    Originally Posted by Regis View Post
    Fantastic, much easier to test weapons on the go, now we just need a way to see the weapons when they spawn (where's that workaround I keep hearing about ).
    Glad you like it, testing attributes before committing them to the config is really what this is intended for.
    I think you might be able to use SetEntityModel as a workaround, never tried it though.
    __________________
    DarthNinja is offline
    eraserhead
    Veteran Member
    Join Date: Nov 2009
    Old 11-29-2010 , 13:03   Re: [TF2Items] Advanced Give Item
    Reply With Quote #9

    Great plugin DarthNinja. Only i'm a little concerned about giving people Valve hat related effects. The whole reason why Valve blocked the equipment manager and TF2Items functionality was because people could freely equip Valve items. So we have to watch out.
    __________________
    eraserhead is offline
    Send a message via Skype™ to eraserhead
    DarthNinja
    SourceMod Plugin Approver
    Join Date: Mar 2009
    Location: PreThinkHook()
    Old 11-29-2010 , 13:31   Re: [TF2Items] Advanced Give Item
    Reply With Quote #10

    Quote:
    Originally Posted by eraserhead View Post
    Great plugin DarthNinja. Only i'm a little concerned about giving people Valve hat related effects. The whole reason why Valve blocked the equipment manager and TF2Items functionality was because people could freely equip Valve items. So we have to watch out.
    This doesn't do anything that can't be done with the tf2items base.
    __________________
    DarthNinja 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 00:28.


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