Keep weapons on job change

How would i make it so when people change jobs on my darkrp server they don’t loose their weapons?

If you have norespawn enabled in DarkRP (see the Admin options). (i.e. you don’t go back to spawn when you change jobs) then you can make a small code change to allow players to keep their weapons.

Open DarkRP/gamemode/player.lua, skip to line 319 or search for the code block below and delete/comment-out the line below in bold: (The gamemode loadout still happens but any acquired weapons will now be kept during a job change)



	if GetConVarNumber("norespawn") == 1 and self:Alive() then
		**self:StripWeapons()** --DELETE THIS LINE
		local vPoint = self:GetShootPos() + Vector(0,0,50)
		local effectdata = EffectData()
		effectdata:SetEntity(self)
		effectdata:SetStart( vPoint ) -- Not sure if we need a start and origin (endpoint) for this effect, but whatever
		effectdata:SetOrigin( vPoint )
		effectdata:SetScale(1)
		util.Effect("entity_remove", effectdata)
		GAMEMODE:PlayerSetModel(self)
		GAMEMODE:PlayerLoadout(self)


Thank you!

[editline]20th March 2012[/editline]

Is there a way I can make it so cops loose their arrest and unarrest stick and guns when they switch?

add this below GAMEMODE:PlayerLoadout(self)


 
self:StripWeapon("arrest_stick")
self:StripWeapon("unarrest_stick")
self:StripWeapon("door_ram")


You can’t really do that as even cops and the chief will get their weapons stripped that they need when joining those jobs. The code will work fine, just add those lines above GAMEMODE:PlayerLoadout(self) and people who aren’t supposed to have them in the job they’re changing to will lose them.

Deleted question

I don’t have player.lua

[editline]7th March 2016[/editline]

Nevermind, article from 5 years ago or smthing