Home » [TF2Items] Give Weapon v3.14159

[TF2Items] Give Weapon v3.14159

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 View Post
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).

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.

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

 

Files

Leave a Reply

Your email address will not be published. Required fields are marked *