Garry's Mod

Garry's Mod

1,992 ratings
Weapon Loadouts
3
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Roleplay, Realism
File Size
Posted
Updated
10.184 KB
29 Nov, 2013 @ 2:50pm
27 Aug, 2014 @ 11:14am
29 Change Notes ( view )

Subscribe to download
Weapon Loadouts

In 1 collection by beth but evil
General Server Content
83 items
Description
An addon that allows you to create and select loadouts for when you respawn. You have the option to add the loadout to the default one, or just replace it. Server admins can make there own loadouts and let everyone else on the server use them, or the owner can force the loadouts and make everyone else on the server only use the server’s loadouts.

This addon took me a while to make because it is my first one, and I wanted to get it non-buggy (if you do find any bugs, please tell me and I will do my best to fix it). This also works with any weapon from any addon as well (should do, if you find one that doesn't, I'll try to fix it).

Tutorial Now here[docs.google.com]

Latest update - I was unwilling to do this update, as a HUGE amount of code needed to be modified/added. Loadouts are now stored using their name, rather than an index. This allows for the server loadouts, which would mess with this index. The loadouts are now selected per-server. This means that you can join different server and have loadouts automatically be selected. Due to the options not saving properly, I am now using my own function to save them, as it is more reliable. The ‘Weapon Loadouts’ tab is now under ‘Utilities’ rather than ‘Options’, which is a suggestion by Leo1250. I will make a tutorial video when I get back off holiday. Even though I have been testing this update a lot, don’t expect it to be bug free just yet. After a few days of it being released, any remaining bugs should have been found by other users and fixed. You can force server loadouts as well, by using the command ‘wl_force_server_loadouts 1’, and then all clients can only use the server loadouts. Setting the ConVar to 0 will stop this action.

New pictures! I need to redo the video and the addon icon (which I don’t know how to do). I did some image trickery to join 2 images together to form 1 for the modify images. I don’t think anyone would be able to see the join!

Please tell me what you think of it! :D
If you find any problems, please give me the error output from the console for me to work with, otherwise I cannot help, as I'm not going to go through all my code to find it. If you tell me what you did to cause it, that would be most appreciated. Just as a side note, if you say that 'it doesn't work' and don't give me any console output, if there is an error, then I won't help, as there are no problems I can find. If there aren't any errors then you are just using the addon incorrectly and you need to watch the tutorial, or use common sense :)

Change Log -
1.0 - First upload, first ever addon :O
1.1 - Fixed the 'Use default' bug that was caused when I made the addon server compatible. >:(
1.11 - Bug fixes and debug code removed.
1.2 - Added entirely new ammo-giving system!
- Changed the wl_giveweps command to wl_giveloadout and modified how it works.
- Fixed the physgun and others not giving properly.
- Fixed addon.json.
1.21 - Added new weapon combobox that allows you to select a weapon from a dropdown list and places the class into the textbox for you.
1.22 - Fixed a bug with the ammo listview where deleting an ammo item would cause and error to occur.
1.23 - Fixed a possible bug with the weapon list.
1.24 - Added a new ammo list. Read description above to learn about this new improvement.
1.25 - Full client-server communication code re-write.
- Concommand blocked and other errors like this should now be stopped, and it will now give you your weapons when you first login to your game!
1.26 - Re-worked the options so that they are now all in the same file (current loadout, addon version and admin only (may be more to come).)
- Added a ConVar to make the addon admin only (optional). Will save across sessions.
- Changed the way the loadouts are saved (stops any errors, possibly making it faster). No data will be lost, as I convert the old data to the new storage method.
- Made the loadouts saving and sending more stable, now no nil or "" values are sent, stopping any errors.
- Modified what the addon prints to the console.
- Stopped the weapon and ammo pick up messages that show when you respawn with a loadout.
1.261 - Fixed a spelling error >.<
v1.262 - Fixed the data transforming bug. To fix this, go to garrysmod/garrysmod/data/weapon_loadouts/ and delete the file 'options.txt'. Sorry for the inconvenience.
v1.263 - Added some code to prevent an error with the 'Default' loadout.
v1.27 - Fixed an error when the weapon_loadouts.txt is not saved properly, it will now detect and automatically fix the error.
- I have also add a 3 level debug system, so if there are any errors in future, please do 'wl_debug_mode 3' (no quotes) to go to the highest debug level and tell me what is printed just before the error.
- This should save across sessions as well. I have also added a delay for the ConVar saving, meaning it will now only check every 10 frames, instead of every 1, decreasing lag considerably.
- I have also touched up on the loading complete prints and changed a parameter on the wl_adminonly ConVar.
v1.271 - Fixed a debug error.
v1.272 - Fixed a spelling error -_-
- Protected ‘Get Current Weapon’ button from erroring.
v1.273 - I have fixed a possible error with one of the debug prints when adding all of the loadouts to a listview.
v1.274 - I have protected the 'Get Current Weapon' button from erroring when you are dead, and I have fixed a problem with deleting an addon.
v1.275 - Fixed a possible error with the options when sending the loadout
v1.3 -Huge changes!
- Loadouts are now stored differently, the default loadouts (now 2) are now stored separately.
- Server loadouts! Admins can now create server-based loadouts, which are sent to clients. These loadouts are added to the normal list, or, if they are forced they will be the only ones showing. These loadouts have security measures server-side, so people cannot do client modifications to bypass it.
- Per-server loadout selections. Loadout selections are now per-server, allowing you to have a certain configuration selected depending on the server. This is based by ip, so if the server name changes to selected loadout isn't lost.
- Since the util.TableToKeyValues and util.KeyValuesToTable functions were being such a pain, I have decided to use my own, custom written functions for the options, which are more reliable.
- The Weapon Loadouts tab is now under 'Utilities' (suggested by Leo1250).
v1.3.1 - Fixed a bug with generating the options file on first load
v1.3.2 - Fixed a bug where converting a loadout with no name errored. If it doesn't have a name, it becomes 'nil'.
v1.3.3 - Fixed a bug where creating a loadout with a name that already exists overrote it. It now adds a '-' on the end to make it unique.
v1.3.4 - Added a feature where getting current weapon adds its primary ammo the the add ammo box.
v1.3.5 - Due to getting the server IP being quite difficult, I have decided to use the host name, as that actually works.
- Fixed a problem with the server side not loading, which makes it seem like the addon just does nothing. Shoutout to Leo1250 for helping me find it!
Popular Discussions View All (29)
7
10 Apr, 2023 @ 10:29pm
[SOLVED] Loadout tabs non-existent, errors ensue...
Good Raptor
6
8 Jun, 2020 @ 12:36am
Cannot save
draugrpeek ✪ Lobones N0RD1CG0D
7
30 Apr, 2023 @ 1:10am
Help with Ammo Types
CryOfCarthage
841 Comments
to be fair the addons pretty old, literally classic gmod era
Dude, is not working?
no more. 21 Mar @ 7:33pm 
This addon doesn't work anymore. Please fix it.
JooJ 7 Oct, 2023 @ 4:20am 
Gives you terrible lag. Avoid at all costs
Бингус 1 Aug, 2023 @ 6:18am 
It works for me and fixes the second player in splitscreen with normal loadouts instead of a custom one!
Silas Glasc 28 Jul, 2023 @ 2:35pm 
Dang. Addon's dead. RIP, looked so frickin cool.
AdorableArabella 7 Jul, 2023 @ 10:04pm 
any replacements for this mod?
76561198820111920 9 May, 2023 @ 6:15am 
Error
Random Person On The Internet 6 Apr, 2023 @ 5:46am 
f in the chat for this addon.it ded.