View Single Post
Trie1950gustrcom
Member
Join Date: Aug 2016
Old 03-30-2017 , 15:34   Re: [TF2Items] Item Designer - Advanced Give Item
Reply With Quote #147

Quote:
Originally Posted by DarthNinja View Post
[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.
Can someone modify this so you can give modified guns to bots? i can't think of a reason that isn't a feature. i have an MVM server, and i just Choose a bot to do something specific, and if i wanted to turn a reg soldier into a Nuke soldier, can't. Would REALLY appreciate it.
Trie1950gustrcom is offline