AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2Items] Item Designer - Advanced Give Item (https://forums.alliedmods.net/showthread.php?t=143586)

DarthNinja 11-21-2010 16:24

[TF2Items] Item Designer - Advanced Give Item
 
2 Attachment(s)
[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.

DarthNinja 11-21-2010 16:29

Re: [TF2Items] Advanced Give Item
 
~Reserved

DarthNinja 11-21-2010 16:30

Re: [TF2Items] Advanced Give Item
 
~Also Reserved

FlaminSarge 11-21-2010 17:12

Re: [TF2Items] Advanced Give Item
 
/gi @all 0 1 127 10 1 0 tf_weapon_knife "134 ; 19"
Crash everything!

Skyrider 11-23-2010 07:30

Re: [TF2Items] Advanced Give Item
 
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.

DarthNinja 11-23-2010 09:03

Re: [TF2Items] Advanced Give Item
 
Quote:

Originally Posted by FF|Skyrider (Post 1355026)
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.

Regis 11-23-2010 11:09

Re: [TF2Items] Advanced Give Item
 
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 :|).

DarthNinja 11-23-2010 12:29

Re: [TF2Items] Advanced Give Item
 
Quote:

Originally Posted by Regis (Post 1355142)
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.

eraserhead 11-29-2010 13:03

Re: [TF2Items] Advanced Give Item
 
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.

DarthNinja 11-29-2010 13:31

Re: [TF2Items] Advanced Give Item
 
Quote:

Originally Posted by eraserhead (Post 1359656)
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.


All times are GMT -4. The time now is 21:48.

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