AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2Items] Give Weapon (v3.14159, 11/29/2013) (https://forums.alliedmods.net/showthread.php?t=141962)

FlaminSarge 10-30-2010 21:58

[TF2Items] Give Weapon (v3.14159, 11/29/2013)
 
69 Attachment(s)
Potential replacement for this plugin: https://forums.alliedmods.net/showthread.php?t=335644

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.

CVARS
  • 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.
COMMANDS (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.

Installation
Quote:

Originally Posted by FunkyLoveCow (Post 1584197)
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.
E.) 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 installing https://github.com/FlaminSarge/tf_sa...elfix/releases, 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


Changelog: MM/DD/YYYY (vVERSION)
Code:

11/29/2013(v3.14159 )
*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.

08/11/2013(v3.1415 )
*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!)
*Fixed builders/sappers
*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.

06/04/2013(v3.141 )
*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.

01/23/2013(v3.14 )
*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

12/22/2012(v3.13 )
*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

10/21/2012(v3.12)
*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.

6/30/2012(v3.11)
*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
*Charging fixes
*Phlogistinator/Eureka Effect work on all classes
*Fixed Gunslinger/other weapon overheal+givew_ex exploit
*Let me know if I forgot any notes

3/2/2012(v3.10)
*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)

12/16/2011(v3.09)
*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

11/10/2011(Gamedata updated)
*Please redownload tf2items.randomizer.txt from the Randomizer thread.
*This fixes a bug where wearable weapons would not be given.

10/27/2011(v3.08)
*Halloween weapons (Wanga Prick, Unarmed Combat)
*Changed RemoveEdict to a Kill input for the wearable removal

10/15/2011(v3.07)
*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.

09/25/2011(v3.06)
*Valve changed some attributes (e.g. Sticky Jumper) so I mirrored that.

09/11/2011(v3.05)
*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.

08/28/2011(v3.04)
*Original + Manno-Tech weapons
*Valve updated the attributes on Jarate, mediguns, and two wrenches for the strange quality stuff, so that too.
07/25/2011(v3.03)
*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
*Summer weapons
*Grordbort weapons
*Texan Love (2161) is back, but kinda underpowered
*Targe emulation tweaked for the Uber update changes

06/25/2011(v3.02)
*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.

06/15/2011(v3.01)
*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

05/29/2011(v3.0)
* 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

04/24/2011(v2.9)
* 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.

03/13/2011(v2.8)
*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.
*Shogun weapons
*Army of One now has a model, which I'll upload soon.
*Fixed a 'derp' in PrepareAllModels() that accidentally cut off long model filepaths.

02/24/2011(v2.7)
*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)

01/09/2011(v2.61)
*Changed Rebel's Curse and Khopesh Climber effect logic a little to make it less hackily compatible with Randomizer
01/07/2011(v2.6)
*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.

12/18/2010 (v2.5)
*Added Australian Christmas update weapons
*Visible Weapons compatibility

12/11/2010 (v1.4.1.2.3)
*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

12/02/2010 (v1.4.1.2.2)
*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.
11/19/2010 (v1.4.1.2.1)
*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)

11/10/2010 (v1.4.1.2.0)
*Re-added sm_give_ex as the permanent weapon command.
*sm_resetex <target> to reset a targets permanent weapons.

11/6/2010 (v1.4.1.1.0)
*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)

10/30/2010 (v1.4.1.0.4)
*First public release: long before this, asherkin made the original and it was awesome.


Known Bugs
*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.


Credits
California Bear- 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 :D
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
http://wiki.alliedmods.net/Team_Fort...nition_Indexes
Or use this, though I won't guarantee that it's up to date.
Spoiler

Quote:

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
How to do custom weapons
The file tf2items.givecustom.txt goes in addons/sourcemod/configs/
It's used to create your own custom weapons.
PHP Code:

"custom_give_weapons_vlolz"
{
    
"9999"
    
{
        
"classname"        "tf_weapon_rocketlauncher"
        "index"        "228"
        "slot"        "0"
        "quality"        "6"
        "level"        "29"
        "attribs"        "134 ; 19"
        "ammo"        "20"
    
}
    
"1304"
    
{
        
"classname"        "tf_weapon_knife"
        "index"        "225"
        "slot"        "2"
        "quality"        "6"
        "level"        "2"
        "attribs"        "215 ; 9999.0 ; 1 ; 0.5"
        "ammo"        "-1"
        "model"        "models/whatever.mdl"
    
}


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 in console/rcon.
Don't make a custom weapon use any of the current weapon indices. It probably won't work.
PHP Code:

"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).
    
}


HOW TO DO CUSTOM MODELS
So you have your custom model, and in the custom cfg, under its custom index, you have that model (or viewmodel) path, e.g.
Code:

"model"            "models/custom/weapons/rebelscurse/c_wrench.mdl"
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:

Code:

models/custom/weapons/rebelscurse/c_wrench.mdl
models/custom/weapons/rebelscurse/c_wrench.phy
models/custom/weapons/rebelscurse/c_wrench.vvd
models/custom/weapons/rebelscurse/c_wrench.dx90.vtx
models/custom/weapons/rebelscurse/c_wrench.dx80.vtx
models/custom/weapons/rebelscurse/c_wrench.sw.vtx
materials/models/custom/weapons/rebelscurse/rebels_curse.vmt
materials/models/custom/weapons/rebelscurse/rebels_curse.vtf

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.

BUT
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.

FlaminSarge 10-31-2010 15:03

Re: [TF2Items] Give Weapon (v2.7, 02/24/2011)
 
3 Attachment(s)
Custom Weapon Models:
Alright, so, dedicated post for all weapon models that I hardcoded into the plugin (this includes Randomizer). Right now, that's:
the Khopesh Climber
the Rebel's Curse

Each has three folders inside, materials, models, and fastdl
Place the materials and models folder in your server's tf folder, then place the contents of the "fastdl" folder (another materials and models folder are those contents) on your sv_downloadurl server's or fastdownload server's tf folder (if you DON'T have a fastdownload server, ignore the fastdl folder).

Credits:
Khopesh Climber - Originally "The Scythe of Slaughter" skin by ez_jamin. Converted to a custom model by Mecha the Slag.
Rebel's Curse - Originally the Golden Wrench by Valve, I fiddled with it to its current state.

Rebel's Curse model updated 04/07/2012. Use the 'v2' file.

Previous 2nd/3rd posts:
Spoiler

DarthNinja 10-31-2010 17:30

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Quote:

SourceMod 1.3.4 required.
Android 1.6, Sourcemod 1.3.4.... whatever's next? Windows 98?

FlaminSarge 10-31-2010 18:13

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
If you can run TF2 on 98, sure. Go ahead.

DarthNinja 10-31-2010 20:41

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Quote:

Originally Posted by FlaminSarge (Post 1338669)
If you can run TF2 on 98, sure. Go ahead.

http://www.youtube.com/watch?v=xfyYzI_WbYQ

TheKisho 11-01-2010 11:30

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Is it by chance posible for you to create a version where users may select a weapon to force upon themselves? Using chat commands (auto hidden to keep chat clean) or console commands. I personal would like the option on my own server. It would be only fair to restrict users from forcing on other people [only admin should be able to force onto others].

Maybe just add this to the existing plugin with a CVAR to enable users to force upon themselves.

Thrawn2 11-01-2010 11:41

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
suggestion: add some natives for other developers to use this.

pretty please :]

FlaminSarge 11-01-2010 21:22

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Natives.... How do i shot natives...
loljk I'll try. In the meantime, try just using the TF2Items Extension natives, that's all this does, use those natives.
Or, copy the code a bit. You'll need the trie for all the weapons if you want all the weapon attributes (I'm presently converting that to a keyvalues, hopefully), plus PrepareItemHandle and Command_Weapon. That should work for any plugin that uses TF2Items.

Also thrawn I have a weapon replace plugin that can replace the sandvich with the shotgun, etc. But a person requested it from me in exchange for a hat, and asked me to keep it private for a while. Sit tight, I'll release it sometime soon or add it to tNoUnlocksPls :P

Thrawn2 11-02-2010 07:47

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Quote:

Originally Posted by FlaminSarge (Post 1339694)
Also thrawn I have a weapon replace plugin that can replace the sandvich with the shotgun, etc. Sit tight, I'll release it sometime soon or add it to tNoUnlocksPls :P

Uhm, i dont understand. tNoUnlocksPls has no issues at all replacing the sandvich with a shotgun. What do you want to add?

FlaminSarge 11-02-2010 19:11

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Lol woops I read wrong. It WOULD be awesome to make a sandvich have the attributes of a shotgun, though :P

Also, I am going to add client commands for the few custom weapons I have in there, such as Ludmila, the Texas Ten Shot, and the Army of One. Useable once every spawn only (otherwise the Army of One would be... VERY overpowered).

TheKisho 11-02-2010 21:15

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Quote:

Originally Posted by TheKisho (Post 1339256)
Is it by chance posible for you to create a version where users may select a weapon to force upon themselves? Using chat commands (auto hidden to keep chat clean) or console commands. I personal would like the option on my own server. It would be only fair to restrict users from forcing on other people [only admin should be able to force onto others].

Maybe just add this to the existing plugin with a CVAR to enable users to force upon themselves.


Or is it possible for one to compile one for their own private use? (What would I need to remove for the commands to be public? I'm not worried about things becoming over powered, unfair advantage or anything of the sort).

Oinkie 11-03-2010 07:40

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Sorry about the cross post, but I suppose this is as much about your plugin as it is about the extension. I posed this initially here: http://forums.alliedmods.net/showpos...&postcount=541

Quote:

Originally Posted by Oinkie
To make sure I am understanding how this works...

I've loaded the extension and plugin from the first post. I've also loaded the new giveweapons plugin by FlaminSarge. Then I started my server. Both the extension and plugin load.

When I type "tf2items_manager_reload" I see:
Code:

20:47:34 L 11/02/2010 - 20:47:56: rcon from "74.120.204.73:46693": command "tf2items_manager_reload"
20:47:34 L 11/02/2010 - 20:47:56: [tf2items_manager.smx] Reloading items list

First, there isn't a confirmation message that the reload is done, right? Because if there is then I've identified my issue (there isn't one).

Second, assuming there isn't a confirmation message, should I be seeing all of the weapons from the giveweapons plugin in the /configs/tf2items.weapons.txt file? Again, if I am, I've discovered my issue as this file doesn't change.


FlaminSarge 11-03-2010 19:27

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Oinkie, the tf2items.weapons.txt does NOT touch Give Weapon. All the weapons in Give Weapon are hardcoded to the plugin itself. What that config txt file thing does is, for tf2items_manager (a separate plugin), it makes a list of players' weapons that it should modify. So if you put in code for changing somebody's wrench to make people golden, then that person, if they use the wrench, will turn people golden.
Reloading the items list basically reloads that file, meaning it re-applies whatever is in that file to the game. Doesn't interact with giveweapon at all.
Like I said, I'm planning to add some type of keyvalues support for custom weapons.
Meaning it will have its own config file.

Also, "Reloading items list" is the confirmation.

Again, tf2items_manager and tf2items_giveweapon are two separate plugins. manager uses that config file to determine what to change on spawn, while giveweapon gives weapons with specific attributes (which are in the plugin not in a config)

@TheKisho I'll add /giveme commands that are toggleable by a cvar.

Oinkie 11-03-2010 20:59

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Quote:

Originally Posted by FlaminSarge (Post 1341469)
Oinkie, the tf2items.weapons.txt does NOT touch Give Weapon. All the weapons in Give Weapon are hardcoded to the plugin itself. What that config txt file thing does is, for tf2items_manager (a separate plugin), it makes a list of players' weapons that it should modify. So if you put in code for changing somebody's wrench to make people golden, then that person, if they use the wrench, will turn people golden.

Could you help me figure out why it's not working for me then? I type, as an example
Code:

sm_give @me 9018
If I am reading the code correctly, this should be a valve rocket launcher. It is announced that I was given weapon, but my rocket launcher doesn't change. I've tried touching a resupply cabinet, respawning, and touching ammo crates. Still just the regular rocket launcher. I've tried this with all of the Valve type weapons I see in the code.

Then I thought that it was related to just the valve weapons so I tried giving myself the direct hit or black box as a soldier. Still keeps me at the regular rocket launcher, even though it announces I got the new weapon.

What am I doing wrong? :(

Thanks for the clarification about tf2items.weapons.txt though. I had been trying forever to get that to be populated. :)

FlaminSarge 11-03-2010 22:22

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
When you do sm_give @me 9018, you should have the valve rocket launcher, which looks almost no different from the regular rocket launcher. Do NOT touch a locker after this or it will be replaced by your normal loadout. Try firing a few rockets, see the difference.
Also, HINT: 8018 and 7018. Heh.

FlaminSarge 11-04-2010 02:38

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Bump, I updated the OP with all the indexes in there so far. I am adding a way to add your own custom item indexes AS LONG AS YOU DO NOT USE THE SAME NUMBER AS THESE ONES. If you try, it'll be overwritten with the data from these, so your own custom ones won't work.

iSins 11-04-2010 04:51

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Hey i love the plugin works ok still annoying sm_giveweapon_ex or sm_give_ex because it don't work all the time and takes while for the weapon to appear but other then that it works great only thing i was wondering is it possible to make it where i give someone a weapon they keep it for ever then have a command to remove it from the person or maybe make it like this sm_givegoldenwrench to a player and they can only use it on engineer and they keep it for ever and make a screen pop up saying Equip Golden Wrench, UnEquip golden Wrench, Equip Golden Wrench Forever, if so i would love to use it on my server to give out for events and stuff :)

FlaminSarge 11-04-2010 18:58

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
lol iSins, glad you posted the suggestion here instead of PM's where I forget. As I think I explained before, the _ex commands basically give the player the weapon when they next have a full loadout change. E.g., spawn or if they touch a locker WHILE THEY HAVE NON-NORMAL WEAPONS. If you touch a locker when you have your normal weapons, it won't regenerate your weapons, and so it won't give whatever you gave with give_ex.

Shortened explanation: give_ex is for applying on spawn or loadout change, doesn't give immediately.

I am adding permanent weapon ones, just wait.
In the meantime you can do:
bind f "sm_give @me 169; sm_give_ex @me 169"
and press it every time you don't have the golden wrench.
That way every time you respawn you WILL have the wrench without having to press the command on respawn. That's how give_ex works. I did give_ex 169 as an engy then switched to scout, I had the golden wrench :D

Jusahra 11-05-2010 21:51

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Think i already know the answer to this. but i figure il ask. Is there any way at all to make the weapons actually display? or has valve broken that far beyond recovery?

Im also making a plugin that works with yours. it populates the server with 1 valve weapon per 12 people. and the weapon is transferred to whom ever killed the original owner,creating a sort of battle for who can control the valve weapons. but. since they dont showup visually. it makes it rather difficult to spot who has them.so far ive gotten some amazing words of appreciation from my server fans :p inspite of the fact that my coding ability sucks. Still. the main question remains " When do we get to see them?" so far ive been saying "Never,because of valve"

"note to self....editing a post while having noscript enabled is evil"

MrSaturn 11-05-2010 23:22

Re: [TF2Items] Give Weapon (v1.4.1.0.4, 10/30/2010)
 
Quote:

Originally Posted by TheKisho (Post 1339256)
Is it by chance posible for you to create a version where users may select a weapon to force upon themselves? Using chat commands (auto hidden to keep chat clean) or console commands. I personal would like the option on my own server. It would be only fair to restrict users from forcing on other people [only admin should be able to force onto others].

Maybe just add this to the existing plugin with a CVAR to enable users to force upon themselves.

You can do this with the buy/credit mod. Just make all prices for commands Zero.

http://forums.alliedmods.net/showthread.php?t=106293

FlaminSarge 11-06-2010 15:01

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Updated to allow you to have a configs/tf2items.givecustom.txt file. Use the example on the main post attachments to make your own. First number is what index you want to define it as (e.g. 9001), classname is tf_weapon_*, meaning whatever its base classname is. index is the actual index of the weapon (e.g. blackbox is 228 ). quality 6 is unlockable, 5 is unusual, etc. Look up the tf2items extension thread for more quality setting info. Level is level, keep it under 127. Finally, Ammo is how much ammo you get when you /give it.

slot 0 is primary, 1 secondary, 2 melee, 3 is 4th slot, 4 is 5th slot, and 5 is for the engineer's building box.

attribs line is just a line of attributes separated by " ; ".
So you would just have the attrib index first, then the attrib value, and then the next attrib index, then the next attrib value. Don't put too many on there, the character limit for that is... 256?
Example: "attribs" "134 ; 19 ; 2 ; 999.0 ; 150 ; 1" would set attribute 134 to 19, 2 to 999, and 150 to 1 (heart effects, +99800% damage done, and turns to gold.

Also, disabled give_ex until it works right.

Sorrowfire 11-07-2010 21:00

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Quote:

Originally Posted by FlaminSarge (Post 1343355)
Updated to allow you to have a configs/tf2items.givecustom.txt file. Use the example on the main post attachments to make your own. First number is what index you want to define it as (e.g. 9001), classname is tf_weapon_*, meaning whatever its base classname is. index is the actual index of the weapon (e.g. blackbox is 228). quality 6 is unlockable, 5 is unusual, etc. Look up the tf2items extension thread for more quality setting info. Level is level, keep it under 127. Finally, Ammo is how much ammo you get when you /give it.

slot 0 is primary, 1 secondary, 2 melee, 3 is 4th slot, 4 is 5th slot, and 5 is for the engineer's building box.

attribs line is just a line of attributes separated by " ; ".
So you would just have the attrib index first, then the attrib value, and then the next attrib index, then the next attrib value. Don't put too many on there, the character limit for that is... 256?
Example: "attribs" "134 ; 19 ; 2 ; 999.0 ; 150 ; 1" would set attribute 134 to 19, 2 to 999, and 150 to 1 (heart effects, +99800% damage done, and turns to gold.

Also, disabled give_ex until it works right.

You might want to add that the turn to gold attribute only works on the wrench/golden wrench. (unless something changed i didn't know about)

But yeah, i like your progress with this Sarge, keep up the amazing work.

Ps: We will see who gets to the poker night items first after its out :P
But if you keep updating at this rate, i might not even be able to figure out the scripting anymore xP

FlaminSarge 11-07-2010 21:07

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Turn to gold, 150 ; 1, only works on all engineer melee weapons. *clarification*

Snaggle 11-08-2010 03:13

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Awesome update FlamingSarge. Asherkins is nice but this is a much easier one to use.

FlaminSarge 11-08-2010 17:08

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
This one is asherkins. Major derp there. It's from his original giveitem plugin, with a couple updates.

Also, slight peeve, but its "FlaminSarge" not "FlamingSarge"...

Skyrider 11-08-2010 19:52

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Bug report:

- Using teleports resets the weapon list.

Snaggle 11-09-2010 03:09

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Quote:

Originally Posted by FlaminSarge (Post 1345408)
This one is asherkins. Major derp there. It's from his original giveitem plugin, with a couple updates.

Well, I meant in terms of the config it's easier to use than the one in Extensions, sorry about the name :P

FlaminSarge 11-09-2010 18:27

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Quote:

Originally Posted by FF|Skyrider (Post 1345516)
Bug report:

- Using teleports resets the weapon list.

What... does this mean? As in it shows "reloading tf2items give weapon list" or something when you take an engineer teleporter? Also if you could get a video up, that'd help.

It really shouldn't do that though. The weapon list doesn't touch the teleport event nor any other events...
In fact, the entire plugin doesn't touch the teleport event...

Skyrider 11-09-2010 19:42

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Quote:

Originally Posted by FlaminSarge (Post 1346241)
What... does this mean? As in it shows "reloading tf2items give weapon list" or something when you take an engineer teleporter? Also if you could get a video up, that'd help.

It really shouldn't do that though. The weapon list doesn't touch the teleport event nor any other events...
In fact, the entire plugin doesn't touch the teleport event...

It means once you use a teleporter, the custom weapons you've given yourself disappears and you'll gain your own weapons back. At least it does for me every time I go through a teleporter.

FlaminSarge 11-09-2010 20:21

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Ohh... there must be some kind of respawn when a player teleports... I'll see what I can do about it. In the meantime, give again when you teleport. Sorry :C

Swixel 11-10-2010 00:16

Re: [TF2Items] Give Weapon (v1.4.1.1.0, 11/6/2010)
 
Quote:

Originally Posted by FF|Skyrider (Post 1345516)
Bug report:

- Using teleports resets the weapon list.

There's nothing in either CObjectTeleporter:TeleporterReceive(CTFPlayer *, float) or CObjectTeleporter::TeleporterSend(CTFPlayer *) which could cause it.

Have you got another plugin or extension which influences teleportation in any way? (i.e. something which could be calling CTFPlayer::Regenerate(void) ?)

FlaminSarge 11-10-2010 19:59

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
Something is definitely wrong with another plugin of yours, then, Skyrider.

In other news:
11/10/2010 update, give_ex is converted to the permanent weapon command. also, sm_resetex to reset the permanent weapons for a client.

JasonGauthierDK 11-14-2010 15:25

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
Some weapons just show up as invisible for other (such as the golden wrench).
Any way to fix that? :)

Also, great and fun plugin.

FlaminSarge 11-14-2010 19:52

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
https://secure.voogru.com/petition/
Read the top couple of lines, they have the most pertinent info.

Mecha the Slag is working on visible weapons, btw.

Sorrowfire 11-15-2010 22:17

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
Quote:

Originally Posted by JasonGauthierDK (Post 1349492)
Some weapons just show up as invisible for other (such as the golden wrench).
Any way to fix that? :)

Also, great and fun plugin.

As Sarge said, its valve's fault. But there is a small work-around in a way. For whatever reason, if your a spy and disguise before giving yourself a weapon. When you un-disguise it will show up to other players. (But that only lasts for the duration of your life or until you switch class/team)

FlaminSarge 11-16-2010 23:01

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
I've also heard that a quick coat of jarate does the trick. So go rub some piss on yourself xD

Pawn 3-pg 11-17-2010 13:11

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
Quote:

Originally Posted by FlaminSarge (Post 1351019)
I've also heard that a quick coat of jarate does the trick. So go rub some piss on yourself xD

I'd heard that too, but I could never get it to work.

Regis 11-17-2010 18:07

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
If the spy thing works, try addcond with the spy disguise smoke and all that jazz, or force a disguise on a non-spy class, then instantly take it off.

JasonGauthierDK 11-18-2010 14:10

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
Quote:

Originally Posted by Regis (Post 1351548)
If the spy thing works, try addcond with the spy disguise smoke and all that jazz, or force a disguise on a non-spy class, then instantly take it off.

Wont addcond require sv_cheats 1?
And how do you force a disguise? :?

FlaminSarge 11-18-2010 17:47

Re: [TF2Items] Give Weapon (v1.4.1.2.0, 11/10/2010)
 
Sourcemod has an addcond native which lets you use addcond without sv_cheats. its TF2_AddCondition(client, condition, duration), and was added in sourcemod 1.3.4.

You can't just type it in console to do it, its something developers put in plugins. I have an addcond plugin that does it.


All times are GMT -4. The time now is 01:37.

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