This plugin allows you to do /giveweapon (or /givew) <target> <itemindex> to give
that player that weapon.
Update 11/29/2013 - The Pi update, round four (3.14159). Fixes TF2II interaction.
A few other bugfixes, plus some new features with models/etc (check out the changelog). The .sp and .smx files changed.
- tf2items_giveweapon_version (3.14159 ): Version number. Do not change. Do NOT place this in your configs.
- tf2items_giveweapon_notify (default is 2): 1- Use ShowActivity2 when givew; 2- Use ShowActivity2 when givew and _ex; 0- Hide all give activity
- tf2items_valveweapons (don't set in any config if you want valve weapons on. The default value is what allows them): If non-default, if anybody tries to give any weapon index whose absolute value is 7018 or between 8000 and 9999, it will not let them. Beware, this also means w/ custom weapons in the config.
- tf2items_customweapons_lowadmins (default is 1): If 0, disables sm_ludmila, sm_gloves, and sm_spycrab (and their longer commands).
- tf2items_allow_gimme (default is 1): 1 to allow the command sm_gimme, 0 to block it.
- tf2items_use_tf2ii (default is 1): Only matters if TF2ItemsInfo is loaded (and plugin was compiled with TF2II include). 1 to grab weapon data from TF2ItemsInfo (therefore automatically updating weapons), 0 to not.
(and a quick refresher on admin overrides
- sm_giveweapon or sm_givew <target> <itemindex>(default "cheats" flag) - Gives a weapon. Works with wearable weapons. Both respond to the admin override "sm_giveweapon".
- sm_giveweapon_ex or sm_givew_ex <target> <itemindex> [mode] (default "cheats" flag) - Gives on inventory application (spawn or locker touch- maybe not locker touch if you don't change loadout). Permanent until map end, disconnect, or sm_resetex. If you include mode as 1, it gives it immediately and sets to permanent. Default mode is 0 if you don't specify. Also works with wearable weps. Both respond to the admin override "sm_giveweapon_ex".
- sm_ludmila (default "generic" flag) - gives ludmila to yourself (index 2041)
- sm_glovesofrunning or sm_gloves (default "generic" flag) - gives the Gloves of Running Urgently to yourself- now that it's officially in, I might remove this (index 239)
- sm_spycrabpda or sm_spycrab - (default "generic" flag) - gives a special Spycrabbing PDA to yourself (index 9027)
- tf2items_giveweapon_reload - (default "cheats" flag) - reloads the custom item list in your configs/tf2items.givecustom.txt
- sm_resetex <target> ["slot"/"index"] [slot/index numbers] - (default "generic" flag) - remove the permanent weapons on a player (so that next time they spawn or touch a locker, they don't get those weapons). To reset a specific slot or index, you do sm_resetex <target> slot 1 3 4 2. You put in the word "slot" or "index" as the 2nd argument, and any slots/indices you want to reset after (up to 32 in one command).
- sm_addwr (sm_addwearable) <index> - adds a wearable weapon onto you without stripping slot 2 (since all the 4 wearable weps are slot 2). Both commands respect the "sm_addwearable" admin override.
- sm_gimme <index> - Same as sm_givew @me, but restricted to yourself. Default admin flag is Kick.
Originally Posted by FunkyLoveCow
If updating TF2Items
A.) Shut down your game server
B.) Download the TF2Items extension from here
. Extract the relevant OS's file to your desktop.
C.) Browse the extracted directory until you get to the level where there are 5 subdirectories (config, extensions, gamedata, plugins, scripting)
D.) In another window, open up a link to your game server - do this either via FTP or SCP or whatever you normally use to move files from your desktop to your game server.
Browse to the tf/addons/sourcemod directory on your game server.
F.) Copy all directories that you see in Step C to the location you are at in Step E (overwriting them). TF2Items is now installed.
Start here if you've already updated TF2Items
1.) Click this link and download the file "tf2items.randomizer.txt" from here
. This is your gamedata
file. Save this file to your desktop.
2.) Move this file, named 'tf2items.randomizer.txt'
to the 'gamedata'
folder you see in Step E above (on your server).
3.) In THIS plugin thread's first post, download the file tf2items_giveweapon.smx
. Save it to your desktop. Do NOT download the file named tf2items_giveweapon.sp
, unless you know exactly what you're doing.
4.) Copy this file, named 'tf2items_giveweapon.smx'
to the 'plugins'
folder you see in Step E (on your server).
Optional but important
) Install TF2ItemsInfo
and the weapon list will automatically update
5.) Turn your game server back on, if it's not on.
If you've got crashing, try putting rndmodelcrashfix.vpk
in "tf/custom/", then restarting your server.
If you are compiling it yourself, you need the tf2items.inc file from the TF2Items extension's download package. Update that if you get any compile errors. Also get the tf2itemsinfo.inc file from TF2ItemsInfo since that's useful for auto-updating the weaponlist.
SourceMod 1.5+ required (needs GetPlayerResourceEntity() from 1.5).
If you want visible weapons, and you have SDKHooks and Attachables installed, https://forums.alliedmods.net/showthread.php?p=1374048
: MM/DD/YYYY (vVERSION)
*Added support for "model_pv", "model_hv", and "model_rv" in the custom config which set the models in Pyrovision, Halloweenvision, and Romevision respectively (yes, Halloweenvision takes over when you've got Halloween/Full Moon mode on).
*Moved Rebel's Curse dissolve to the ragdoll dissolve weapon attribute.
*Fixed Katana adding eye particles/heads (I think I left in the old eye particles, not the weird new green ones).
*Updated sm_givew and sm_givew_ex to respect the admin accesses for sm_giveweapon and sm_giveweapon_ex, respectively. Same goes for sm_addwr with sm_addwearable.
*Added 1.5x overheal limiter every time sm_gimme is used.
*Fixed interaction with TF2ItemsInfo (so botkillers/etc should work again).
*Fixed TF2II-based shotgun and sapper issues.
*Did NOT update the internal item list for the latest weapon changes (Amputator, etc). I'd highly suggest just getting TF2ItemsInfo to fix this, since I fixed most of the interaction between the two plugins with this update.
*Yes, the version numbers are getting ridiculous, but I'm not going to make it 3.15 or 3.2.0 or whatever until I have a bigger update than just bugfixes.
*Made Heavy mediguns not bonemerge, so they don't end up at the map origin.
*Fixed issue with empty attribute strings
*Added some attributes to the Army of One (large explosion!)
*If your server is crashing, try downloading this VPK and placing it in "tf/custom/" on your server. Clients don't need to download it, and you might have to restart your server after placing it there for it to be "found".
*Deflector defaults to have the attack projectiles attribute.
*Fixed worldmodels, hopefully.
*Fixed Powerup Canteens not equipping properly.
*Fixed Ap-Sap, I think.
*May or may not crash on Sappers occasionally, temporary (or possibly permanent) fix will be posted if bug exists.
*A huge update is in the works that will change a bunch of stuff regarding item effects, etc.
*Fixed "viewmodel" custom config line not working
*TF2Items_GiveWeapon native now returns the given entity, or -1 on error/failure
*Made Crossbow reload fix ignore Soldiers because weirdness ensued
*Charging now resets bashing on all classes properly (you used to be able to bash only once before visiting a resupply locker as a non-Demomen)
*Megaheal no longer prevents the Mmmmph/Eureka stun time.
*Prevented possible infinite loop in Amputator effect
*Amputator effect works on all classes
*Charging on non-Demomen (Targe/Screen) requires that you hold Reload while you press AltFire
*New weapons added (though if you've got TF2ItemsInfo you'd already have them)
*New weapon ammo calculation fixed
*Cleaned up backstab disguise code a bit
*Fixed Market Gardener for all classes
*Fixed Ludmila not behaving properly
*Altered Ludmila's viewmodel appearance slightly
*Fixed reload bugs/exploits
*Fixed shotgun issues with TF2II
*Updated for TF2II updates
*Fixed some integer attributes' behavior (133, 143, 147, 152, 184, 185, 186, 192, 193, 194, 198, 211, 214, 227, 228, 229, 262, 294, 302, 372, 373, 374, 379, 381, 383, 403, 420)
*Updated attributes for some of Valve's updates
*Fixed crits/minicrits on Chargin' Targe/Splendid Screen
*Added support for custom viewmodels (they attach to the normal viewmodel) using the "viewmodel" line in the custom config. Look at the custom config instructions section of this post for more info.
*Added Sleeping Dogs weapons (but not any weapon released after that)
*If you want ANY of the recently added weapons (botkillers, Freedom Staff, etc), you will need TF2ItemsInfo. Link's right below.
*Added TF2ItemsInfo integration, will auto-update weapons.
*Pyromania update weapons/weapon changes
*Enforcer/Jumper/Pan/other weapon updates
*Eyelander headtaking on all classes (beta)
*Your Eternal Reward backstab disguise on all classes (beta)
*Fixed rage gain for some weapons
*Fixed Gunslinger+Kritzkrieg bug
*Phlogistinator/Eureka Effect work on all classes
*Fixed Gunslinger/other weapon overheal+givew_ex exploit
*Let me know if I forgot any notes
*Added Black Rose
*Added Manmelter changes from an update
*Chargin' Targe and Splendid Screen now work with any class
*Buff Banner, Battalion's Backup, Concheror now gain charge properly
*Army of One now uses index 18 internally (still 2228)
*Australian Christmas weapons
*Apoco-Fists and Sharp Dresser
*Made HHH axe not cover Heavy's face (only applies to 266 and 9266)
*Updated/added some weapons from TF2 Beta
*Attempted to make the Chargin' Targe look better on non-Demomen
*Please redownload tf2items.randomizer.txt from the Randomizer thread.
*This fixes a bug where wearable weapons would not be given.
*Halloween weapons (Wanga Prick, Unarmed Combat)
*Changed RemoveEdict to a Kill input for the wearable removal
*Manniversary weapons/attribute changes
*Added some beta weapons, but they may not work correctly
*Pocket Protector - index 2129: custom Battalion's Backup that builds rage by being healed (gaining health from being healed by a medic). Rage is a minicrit buff that also prevents all buffed players from gaining health from medics for the buff duration.
*Valve changed some attributes (e.g. Sticky Jumper) so I mirrored that.
*I forgot the Rift weapons in the weapon list on this post. Woops.
*Added sm_gimme command. Thanks, bottiger!
*sm_resetex now accepts "slot" or "index" after the target argument, and any numbers after that to reset those indices or slots.
*Pyros, Heavies, and Soldiers can now taunt with the Reserve Shooter and Family Business.
*Original + Manno-Tech weapons
*Valve updated the attributes on Jarate, mediguns, and two wrenches for the strange quality stuff, so that too.
*Valve weapons are now -9999 to -8000, -7018, 7018, and 8000 to 9999.
*Wording on the command activity changed
*Fixed goldslinger model stuff (I still need to post that model somewhere, so don't go looking for it)
*TF2Items 1.4.7 Force_Generation changes
*Updates to Uber update weapons that Valve did soon after the update
*Texan Love (2161) is back, but kinda underpowered
*Targe emulation tweaked for the Uber update changes
*Uber update weapons
*/givew for slot 0 weapon (primary slot) will remove the Demo boots (just as giving a slot 1/secondary weapon removes gunboats, etc)
*Removed most of the beta weapons since they made it into the Uber update.
*Maul and Saxxy added, along with code changes required for saxxy: you can use "saxxy" as a classname and it will use the classnames the saxxy uses for each class.
*Version cvar updates when plugin is reloaded
* Visweps.inc is now optional when compiling
* Added Fishcake, Three Rune Blade
* Added Beta Weapons: Quick-Fix, Detonator, Beta Syringe Gun, Beta Bonesaw, Pocket Shotgun, Beta Sniper Club, Beta Sniper Rifle
* Valve weapons are now 7018, 8000 through 9999, none others.
* Valve weapon cvar's "allow" value is different, you might wanna go check it out in the source, and update any cfgs.
* All Timers use UserIds now.
* Added Golden Gunslinger, will upload a worldmodel soon (visible!)
* Attempted to make the targe stick to non-demomen's arms for some classes
* Visible Weapons no longer works, but the code autodisables if it isn't loaded, so no change there...
* Removed index 31 (valve removed it a loooooong time ago)
* Updated attributes from April 14th, 2011 Update
* Fixed Wearable classnames from April 14th, 2011 Update (NOTE: CHANGE ALL tf_wearable_item to tf_wearable, and tf_wearable_item_demoshield to tf_wearable_demoshield)
* Changed the preparemodels logging lines a bit
* THE NATIVE HAS CHANGED, added ammo argument. Check the inc.
*Reverted Rebel's Curse dissolve to previous
*Valve weapons are now classified as 7018, 8018, 8045, and all the 9000s
*Fixed givew_ex causing people in spec/dead to get floating visweps
*Tried making 2041 (Ludmila) look as it does in VisibleWeapons
*Removed Medic/Degreaser view fix (half-invis'd degreaser) since it doesn't seem to occur anymore
*Added FaN/Sniper fix since the FaN seems to block Sniper's crosshair (half-invis'd now)
*Worldmodels now change for the player themselves, based on the "model" line.
*You can pass "-1" as the model to make it not send a model to visweps.
*Added 9266 - the REAL Horsemann's Headtaker- really OP, almost like you're a Horsemann. It also adds the model and giant axe onto you while you have it out.
*Army of One now has a model, which I'll upload soon.
*Fixed a 'derp' in PrepareAllModels() that accidentally cut off long model filepaths.
*Changed Playerdeath Post hook to Pre hook for the Rebel's Curse. Also changed its dissolve effect to be "Heavy Lightning" apparently.
*Added Jar of Ants, index 2058
*Added Wearable weapons (131, targe; 133, gunboats; 57, razorback; 231, danger shield)
*Changed Khopesh Climber to be Level 11
*Rebel's Curse is now 2197 (viewmodel is also working but needs a separate plugin, will post soon).
*Targe on all classes will sorta work. They charge forward for a bit. Sorta.
*Added the "Upgradeable" weapon indexes (the indexes for the renamed weapons)
*Changed Rebel's Curse and Khopesh Climber effect logic a little to make it less hackily compatible with Randomizer
*Added tf2items_valveweapons and tf2items_customweapons_lowadmins cvar.
*Added an optional [mode] third argument for givew_ex, if 1, gives right then and there, but also permanent.
*In the keyvalues cfg, can add a line under the rest for "model" if you have the Visible Weapons plugin also installed. Will set the model others see to a model you specify. See the box about it below for more details on how to set this up. ALSO: will only work if item index is under 999999. Will change if need be.
*Made it so weapons that normally block the screen (or at least the crosshair, such as kritzkrieg on sniper) are partially invisible, so you can see you have it out, but see through it too.
*Forgot from the previous version, if Mecha the Slag joins your server and you are giving out Khopesh Climbers, he gets a self-made one. Makes sense, no? I haven't done this for the weapons I made.
*If using with VisibleWeapons, all weapons should now have models. Ludmila uses Sasha with the Natascha band. The Khopesh Climber uses a custom model (download link will be in the aforementioned box below). The Rebel's Curse does too. Other ones use their base item models for now, e.g. Army of One uses Black Box.
-All weapons created in the custom cfg will use the model of their item index, unless specified otherwise.
*Some fixes to weapon attributes
*Oh! Rebel's Curse= Purple glowing, pulsing wrench. Right now, for viewmodel, its partially invisible and a bit darker than a golden wrench. I am going to try to get it to fade in and out later. It has attributes. Might need some balancing.
*The TF2Items_CreateWeapon native changed, so you can do model in that too (for VisibleWeapons)
*I have to shorten the plugin library name in the next update, which will affect the .inc file. Be warned.
*Added Australian Christmas update weapons
*Visible Weapons compatibility
*Added tf2items_giveweapon_notify cvar, which determines how to show the plugin's activity. 0- Only show to client using command, 1- Broadcast givew to all with ShowActivity2, but not _ex. 2- Show both to all. (Follows sm_show_activity convar, btw)
*New weapon 9205
*Hopefully fixed only getting 2 attributes on the customs cfg
*Added natives, look inside the tf2items_giveweapon.inc file to see
*Fixed sticky jumper not showing as one
*Added Khopesh Climber
*Changed sm_give to sm_givew and sm_give_ex to sm_givew_ex. Update your menus and such!
*Some fixes hopefully, such as with the custom items file only applying 2 attributes.
*The Khopesh Climber will fully work with the next Randomizer update if you have it.
*Added the 11/19 weapons
*Added Fighter's Falcata- Kukri with faster swing rate and greater damage but does not random crit and you take 15 damage on each hit. Double-edged sword type deal. Still really powerful.
*Like Valve, changed original Lugermorph to Vintage and the new one is "Unique" unlockable quality (normal unlockable)
*Re-added sm_give_ex as the permanent weapon command.
*sm_resetex <target> to reset a targets permanent weapons.
*Allowed for a custom weapons config file to define your own custom weapons
*Fixed the Sticky Jumper showing itself as a normal stickybomblauncher, now it's actually a sticky jumper
*Removed give_ex for the time being, as it seems very buggy at the moment.
*^Give_ex is now the permanent weapon command, and does ammo right (gives .1 seconds after locker touch)
*First public release: long before this, asherkin made the original and it was awesome.
*Ammo is set correctly when the weapon is given, but when players pick up ammo boxes, the ammo sets to what the class normally would get from the pack. I have the fix, but I want to test more on it.
- for a server on which to test this; that server is gone now :C canceled...
asherkin- for the TF2Items extension and the code to give
weapons to clients using that extension (plus NULL bug stuff)
naris- for the original stocks to set ammo amounts
DarthNinja- I looked at his code for Have Some Piss and Have Some Ballz to set ammo correctly for some weapons (now all weapons)
"Q" and MrSaturn21
- for another server on which to test this. Working perfectly at the moment
jameless- for helping me test a lot, and helping find which items have the NULL bug for TF2Items_GiveNamedItem
Sorrowfire- for putting in Polycount Weapons
Mecha the Slag- Khopesh Climber!
ummja/Noob Lord - more help with testing
_1Swatty - LibraryExists stuff for Visible Weapons compatibility
All the other testers- for testing. and bug-reporting. and possibly for complaining.
Item Indexes to Use
Or use this, though I won't guarantee that it's up to date.
How to do custom weapons
9018 - Valve Rocket Launcher
9020 - Valve Sticky Launcher
9014 - Valve Sniper Rifle
9013 - Valve Scattergun
9021 - Valve Flamethrower
9017 - Valve Syringe Gun
9015 - Valve Minigun
9024 - Valve Revolver
9009 - Valve Engy Shotgun
9029 - Valve Medigun
2041 - Ludmila
9027 - Spycrab PDA
2061 - Fire Retardant Suit (still testing. It's a revolver that does no damage but proves some type of fire protection, currently set to not set you on fire if you are disguised)
8018 - Rapidfire Valve Rocket Launcher (VERY CHEAP)
7018 - Rapidfire Community Rocket Launcher (LESS SO, BUT STILL)
8045 - what I can only call, "the derpFaN"
9205 - Try it and find out. Let's just say it's Robin's, and actually exists now rather than in the past.
BETA WEAPONS (the ones recently added to the TF2 Beta; technically Ludmila should go here but meh. Also NONE OF THESE MAY WORK, I DON'T KNOW.):
19010 - Beta Pocket Rocket Launcher variant 1
19011 - Beta Pocket Shotgun
186 - Beta Quick-Fix
19012 - Beta Split Equalizer 1
19013 - Beta Split Equalizer 2
19015 - Beta Sniper Rifle 1
19016 - Beta Pocket Rocket Launcher variant 2
19017 - Beta Pocket Rocket Launcher variant 3
Custom Item Requests by friends/random adds:
2129 - Pocket Protector (Battalion's Backup with different Rage mechanic: Build rage by gaining health from medics. Unleash Rage for minicrits, but buff causes inability to gain health from medics for duration of buff).
2141 - The Texas Ten-Shot (Frontier Justice mod: 10 shots, damage buff for each consecutive shot, more max ammo, very slow reload, also has a domination symbol thing near its muzzle)
2161 - Texan Love (Big Kill mod, but meant for engy secondary: Faster shooting and more accurate, hopefully can shoot sappers off buildings with a full clip, but slow reload and heals slower)
2127 - Some special direct hit a friend requested: 2 shot clip, fast shots like the Direct Hit, extra damage like the DH, minicrits airborne targets like the DH, increased damage taken from bullets like the Pain Train
2159 - A testing Dalokohs Bar weapon I added to see if I could make other classes have temporary +50 max health. It *sorta* works right, but it's more of a testing item, so avoid.
2433 - Same as above, but for the Fishcake
2228 - The Army of One: A special type of Black Box that I saw on a YouTube video (used the Direct Hit model in it http://www.youtube.com/watch?v=I0wg0PvP0zg#t=3m58s)
2009 - A shotgun that uses the Frontier Justice Model but with normal attributes,
since the normal shotguns are buggy. Primary Shotty.
2193 - Fighter's Falcata. Faster fire rate, more damage, but -15 hp when you hit somebody.
2171 - Khopesh Climber. Climb walls by whacking them! Thanks to Mecha the Slag.
2197 - Rebel's Curse. It's a wrench. A glowy purple wrench. IT DISSOLVES THINGS.
2058 - a Jar of Ants
9266 - Horsemann's OP Headtaker- makes you like the Horsemann!
5142 - Golden Gunslinger
The file tf2items.givecustom.txt goes in addons/sourcemod/configs/
It's used to create your own custom weapons.
"attribs" "134 ; 19"
"attribs" "215 ; 9999.0 ; 1 ; 0.5"
At the top of the file is custom_give_weapons_vlolz, which shouldn't change.
In the next bracket down is the first custom weapon index you want to create, e.g. 9999. Under that you specify classname, index, slot (0 is primary, goes up to 5), quality, level, attributes, ammo, and model.
Attributes are formatted like so: "attribute1 index ; attribute2 value ; attribute2 index ; attribute2 value" etc. You can get these values from items_game.txt
After changing the config, do tf2items_giveweapon_reload
Don't make a custom weapon use any of the current weapon indices. It probably won't work.
HOW TO DO CUSTOM MODELS
"custom_give_weapons_vlolz" //leave this alone
"9999" //index you want the weapon set as (/givew @me thisnumber)
"classname" "tf_weapon_rocketlauncher" // weapon classname
"index" "228" //actual weapon index
"slot" "0" //slot 0 - 5 for primary to whatever the last slot is (build box?)
"quality" "6" //item quality, as in strange, vintage, unique, etc.
"level" "29" //level, simple.
"attribs" "134 ; 19" //attributes.
"ammo" "20" //initial ammo to set for that weapon when it's given
"model" "models/player/heavy.mdl" //change the worldmodel of the weapon. if it's a custom model, read the stuff below
"viewmodel" "models/weapons/c_models/c_bigaxe/c_bigaxe.mdl" //used to attach a model to the viewmodel of the weapon. Try not to use a model that already has hands on it (so use the w_model/c_model if you can).
So you have your custom model, and in the custom cfg, under its custom index, you have that model (or viewmodel) path, e.g.
The FIRST thing the plugin does is look for a .dep file (just like the TF2
Equipment Manager). This is a text file that, on each line, has a different, non-standard file that TF2
needs to both precache and make clients download. SO! the .dep file for the above model would be:
Because it uses those materials and models.
So now these will all download for clients, and your custom weapon models will work.
You can also use "model_pv", "model_hv", and "model_rv" for Pyrovision, Halloweenvision, and Romevision, respectively.
IF the .dep file does not exist (as in, you do not make one), but the model DOES exist (e.g. you decide to use a currently-existing weapon model in place of the one that's on the weapon), it will precache that (already-existing) model. It won't add it to the downloads table for clients to download, though.
Also, if sv_downloadurl is not blank on your server, it means you have a redirect! (If your provider is gameservers.com, they should automatically mirror any files you put on the server to the redirect). If not, you have to put the models on the Redirect/FastDownload server too (note to people that already know this: think of those that don't know). If you are unaware how to, ask somebody for help! No doubt somebody around you will know how.
Custom weapon models are in the 2nd post
. This includes the Khopesh Climber and the Rebel's Curse.
Alright, I'm done talking for now.