Weapon Saving System (CakescriptG2)

I’ve been modifying CakescriptG2 here and there, and it’s really helped me to understand a bit more about Lua (though I’m nowhere near as good as I’d like, obviously). The problem I’m facing now is, I’d like to create a weapon save system. I’ve used some custom weapons from CS: S, and got them working properly with ironsights, etc. Now, I’d like to make it so that players may save them so that they will be there the next time they connect to the server. Unfortunately, I have no idea as to how to go about this. If anyone could provide some insight, that’d be much appreciated. Thanks in advanced everyone.

Instead ‘wasting’ your time trying to code that, you should tell them(your players) that they can drop it and put it in their inventories, and tehn disconnect. However if you do that for a learning purpose this can help you:

**[Player.GetWeapons

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Player.GetWeapons)**

**[File.Write

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=File.Write)**

those should help you.

Unfortunately, CakescriptG2 doesn’t have a drop weapon function that turns given weapons back into the weapon item once you’ve got the weapon. (At least I’ve never seen such a command)

I’ll check out the links you provided, though.

Edit: I took a look at these, and (while I already suspected this), I think coding a weapon save/load system would be a little over my head without some help. I don’t really know where the code would go or what it would even look like. I’m going to take a look around and see if anyone has already come up with a system, as I’d much prefer if I could find someone who has and studied their code, rather than much through one of my own design and ruin things without understanding.

You could also use sqlite, also the script would just go in lua/autorun.

Erm… for a gamemode… no it wouldnt.