• Star Wars Armory System
    3 replies, posted
Garry's Mod Armory System A star wars themed armory addon which allows your community to purchase weapons using darkrp cash and upgrade them using upgrade points. Each weapon has its own level and can be upgraded increasing its damage and clipsize as well as decrease its recoil. Note: The config is located in lua/armory-system/config_armory-system.lua Features A detailed config ranging from adding weapons to customizing each individual weapon level. Ability to spawn an armory entitiy, which will open the armory menu when pressed on. Customized weapon stat upgrades for each weapon. Other things..... Useful Commands (default commands) !armory - (Chat command) Allows the player to open the armory via a chat command. armory_spawnArmory - (Client console command) Allows the player to spawn an armory entity. armory_editEntities - (Client console command) Allows the player to edit the currently spawned armory entities. armory_giveUpgradePoints - (Client console command) Allows the player to give upgrade points to a certain player. Download (github) Download the script here Note: I kinda suck at coding and this is my first main project i've ever released to the public, so please be kind when judging my code.
This is pretty cool! The derma is very sleek looking. Couple of things I noticed: 1) You save the xp and kill directly to a text file after every kill. That may not be costly for a small server, but it'll start doing some damage later on 2) Your recoil upgrades are ADDING recoil to the gun, are you sure that's what you meant to do? 3) It seems like the upgrades only effect the current weapon, but you can apply it to all weapons by looping through the player's weapons here: Player/GetWeapons
Thanks for the reply, I am always open to ways I can do things better! 1) I agree, I didn't think of this. Maybe I can store the players weapon data in pdata? Would that be more efficient? 2) Yes its adding recoil because in the config, the player sets the recoil using a negative number, which seems less confusing to people since they do want to decrease the recoil. 3) That would definitely be a better way to do it than how I can currently doing it.
I'd recommend MySQLite because it's, as far as I know, the most efficient and optimized way to store data. Not sure if it works for other gamemodes though. But it allows you to code both for sqlite and mysql at the same time. For example, this is how you store levels data on player's steamid: function Armory_DBinit() MySQLite.query([[CREATE TABLE IF NOT EXISTS armorylevels( uid VARCHAR(32) NOT NULL, armlevel int NOT NULL, UNIQUE(uid)  ); ]]) end hook.Add("DarkRPDBInitialized", "unique_name_for_armory_db", Armory_DBinit) -- Don't forget to initalize! the main thread with all examples is here.
Sorry, you need to Log In to post a reply to this thread.