Description:
This plugin was in a response to a
semi-request in the Scripting Forum. This plugin will set levels and rarities/qualities of weapons (based on slots) by reading a config file.
Screenshots:
Purple Flare Gun
Blue Disguise Kit
Orange Shotgun
Purple Jarate
CVars:
weaponadjuster_version 0.1 - Version of the plugin.
wa_configfile configs/wadjust.cfg - Designated location of the config file (if you decide to rename the config or place it in a different file, you will need to adjust this cvar.)
wa_enable 1 - Enable the plugin.
Setup:
Place
weaponalter.smx in your
sourcemod/plugins folder.
Place the example
wadjust.cfg file in your
sourcemod/configs folder, it is recommended that you read the guide below on how to configure this.
Configuration:
Once you've placed everything on your server, on restart or map change, you should find that all players' weapons are level 100 and appear with yellow text, even the standard weapons. You're free to change this and add more conditions, as many as you like, I will attempt to demonstrate usage of all possible values here.
First and most important, max_nodes
must be specified at the start for the plugin to know how many nodes/conditions it is checking, here is the example config:
Code:
"weapons"
{
"max_nodes" "1"
"1"
{
"level" "100"
"rarity" "3"
}
}
These images roughly represent the outcome of the config.
max_nodes tells the plugin that there is one node to check, if you leave that alone, but add more nodes, the plugin will ignore them. max_nodes must equal your latest node, and you must not skip any numbers when numbering each node.
Next, conditionals, these are the conditionals that the plugin will check for:
PHP Code:
name_contains // Does the client's name contain what ever is specified here?
steamid_eq // Does the client's steam ID match this one?
flags // Does the client have the sufficient admin flags?
class_eq // Is the client this class?
/* TO DO
*
* map_eq // Are we playing a certain map?
*/
The plugin checks each condition, if it comes across a mismatch, the check is aborted and the weapon is not changed. If you leave out a condition, it will not perform that check (eg: missing out class_eq will mean that any class can qualify for a weapon change)
These are the other values:
PHP Code:
slot // Which slot to change (0 = Primary, 1 = Secondary, 2 = Melee etc I THINK). Use -1 or skip it to change all weapons for a client.
level // Level to set the weapon. -1 or skip it to leave alone.
rarity // Quality to set the weapon (Does not allow Community or Valve (7 or 8)). -1 or skip it to leave alone.
/* TO DO
*
* color // as opposed to rarity, specify a valid colour and the equivelant quality id will be used.
* slotex // as opposed to an index, specify "primary, secondary, melee" etc and the equivelant slot id will be used.
* hat // Defaults to non-zero, if set to 1, the slot check is ignored and instead the adjustment is made to the client's current hat, if they have one.
*/
Now, the example configuration will set everyone's weapons to level 100 and turn them yellow, let's say I wanted only to give Scouts these weapons, I would need to adjust the condition:
Code:
"weapons"
{
"max_nodes" "1"
"1"
{
"class_eq" "scout"
"level" "100"
"rarity" "3"
}
}
But maybe I just want to change it for my members of my clan? No problem at all:
Code:
"weapons"
{
"max_nodes" "1"
"1"
{
"name_contains" "-KJ-"
"class_eq" "scout"
"level" "100"
"rarity" "3"
}
}
Perhaps I want to give Soldier's a different colour for their Rocket Launchers specifically, whilst still allowing Scouts in -KJ- to have yellow Scatterguns, I'd need to add a new node, and I'd need to adjust max_nodes to support this:
Code:
"weapons"
{
"max_nodes" "2"
"1"
{
"name_contains" "-KJ-"
"class_eq" "scout"
"level" "100"
"rarity" "3"
}
"2"
{
"slot" "0"
"class_eq" "soldier"
"level" "100"
"rarity" "6"
}
}
Finally, my dearest admins want Blue named weapons, I've added the flags feature to allow people to target admins/donators/whoever you have in your community very easily, as seen below:
Code:
"weapons"
{
"max_nodes" "3"
"1"
{
"name_contains" "-KJ-"
"class_eq" "scout"
"level" "100"
"rarity" "3"
}
"2"
{
"slot" "0"
"class_eq" "soldier"
"level" "100"
"rarity" "6"
}
"3"
{
"slot" "2"
"flags" "z"
"rarity" "4"
}
}
Final example: I adore my Flare Gun but would love to make it look even more awesome, without adjusting everyone else's Flare Gun!
Code:
"weapons"
{
"max_nodes" "1"
"1"
{
"steamid_eq" "STEAM_0:1:14783567"
"class_eq" "pyro"
"slot" "1"
"level" "100"
"rarity" "5"
}
}
Rarity Index Numbers:
Code:
1 = Olive
2 = Dark Green
3 = Yellow (Unique Unlocks)
4 = Blue
5 = Purple
6 = Orange
If there is any other part of configuration that you're unsure of, feel free to ask and I'll do my best to explain it and perhaps add it to this guide.
---
Commands:
- wa_reload - Reloads the config.
- wa_setweapon <client> <slot> <level> <rarity> - Set a player's or players' weapon.
- wa_setweapons <client> <level> <rarity> - Set a player's or players' weapons.
- wa_unsetweapons <client> - Reset a player's manually set weapons.
- wa_hideinfo <client> <slot> - Hide the inspect bar for a weapon.
The set/unset weapon commands above override the config, so if an admin gives themself a level 100 orange wrench with the config, and then sets it to level 0 in-game, it should stay like that for the remainder of the map.
---
Version History:
0.2
- Added translation support
- Added wa_setweapon, wa_setweapons, wa_unsetweapons and wa_hideinfo, to allow admins to control peoples' weapon details in-game.
0.1
TO DO
Commands to adjust/hide/reset a player's or players' weapon(s).
Translations
- Optional messages to appear to someone when their items have been automatically changed.
- Fix wa_hideall (as seen commented out in the source files)
- Allow for admins to add directly to the config while in game.
---
There is plenty to be done to extend on this, for now, it's as simple as adjusting the config and the players that match certain nodes will have their weapons adjusted.
The plugin hasn't been tested thoroughly yet and so some errors are possible. I'll be
fixing improving it over the weekend and more!
NOTE: The attached .sp file uses the 1.2 compiler, if you're using SM 1.3 and want to ensure maximum compatibility then it is recommended that you download the .zip file.