Permanent SWEPS

Hello, I have another question. I’m trying to make it so once a player buys a gun, they keep it, even after death. I know that most gamemodes run the strip command in order to get rid of the HL2 SWEPS, on spawn. I cannot really figure out how they make it so that you keep your gun forever, I assume it’s something to do with the shared.lua

For what gamemode? You could make the buy function modify a pdata value, and use glon.encode/decode to keep an inventory of what they buy. When they spawn, check the pdata and loop through the table to give the weapons inside the inventory.

This may not be exactly what you’re looking for, but you really didn’t give much information.

best practice would be to have a table on the server:
[lua]GM.PlayerWeps = {}[/lua]

then when the player actually gets the weapon:

[lua]
GAMEMODE.PlayerWeps[self:SteamID()] = GAMEMODE.PlayerWeps[self:SteamID()] or {};
table.insert(GAMEMODE.PlayerWeps[self:SteamID()], strWeapon);
[/lua]

then you hook it in:
[lua]
function GM:PlayerSpawn(ply)
if (self.PlayerWeps[ply:SteamID()]) then
for _, wep in pairs(self.PlayerWeps[ply:SteamID()]) do
ply:Give(wep);
end
end
end
[/lua]

the gamemode is liquid darkrp

pardon me, but the table would go into the server init file correct?

sure