Arrest Baton Immunity

Hey,

If anyone can help me with the immunization of the arrest baton for government officials, It would much appreciated!

I can add only one job such as Police Officer and not Swat etc.

I can use the “cp” for one of the jobs so they do not get jailed.
For example:


TEAM_POLICE = DarkRP.createJob("Police Officer", {
	color = Color(25, 25, 170, 255),
	model = {"models/player/nypd/male_02.mdl", "models/player/nypd/male_04.mdl", "models/player/nypd/male_05.mdl", "models/player/nypd/male_07.mdl", "models/player/nypd/male_08.mdl", "models/player/nypd/male_09.mdl"},
	description = [[The protector of every citizen that lives in the city.
		You have the power to arrest criminals and protect innocents.
		Hit a player with your arrest baton to put them in jail.
		Bash a player with a stunstick and they may learn to obey the law.
		The Battering Ram can break down the door of a criminal, with a warrant for their arrest.
		The Battering Ram can also unfreeze frozen props (if enabled).
		Type /wanted <name> to alert the public to the presence of a criminal.]],
	weapons = {"arrest_stick", "unarrest_stick", "glock17", "stunstick", "door_ram", "weaponchecker" , "weapon_baton", "weapon_arc_atmcard"},
	command = "cp",
	max = 4,
	salary = GAMEMODE.Config.normalsalary * 1.45,
	admin = 0,
	vote = true,
	hasLicense = true,
	category = "Government Officials",
})

I know for a fact I can’t use cp on all jobs that I want. And I did disable CP can arrest CP in settings for darkrpmodifcation

Edit the Stun Stick code to check the Entity’s job after the trace.

I appreciate the help, I really wouldn’t know where its located or what to do. If you help me then THANKS!

Find that file, and do as code_gs said, in the SWEP:PrimaryAttack() function

No one is going to spoon-feed, and if someone does, you’ll never learn. Try for yourself. You can always post back here again, if you get any errors, etc.

I don’t think I’m understanding why you can’t use CP for all your CP jobs? Was there a limit added for the amount of CP jobs you can have?

CP doesn’t mean their command is “cp”. It means at the bottom of the jobs.lua under the CP table, their TEAM_NAME is there

Thanks so much for the help, I am going to try it today!

[editline]13th August 2015[/editline]

And if I do “cp” for the jobs I want, I get an error saying it’s a non original command

Because you’re not supposed to put “cp” as the command.

At the bottom of your jobs.lua, there should be a section that says CivilProtection or IsCP or some shit like that. That’s where you define it

You shouldn’t edit DarkRP files, use hooks instead.

Put this code somewhere serverside (lua/autorun/server for example).


hook.Add("canArrest", "Civil Protection", function(arrester, ply)
	if ply:isCP() then
		return false
	end
end)

There is literally no reason to put extra code if he just defines the CP properly.

In the bottom of the jobs.lua, there is a section that is like this

[lua]
GAMEMODE.CivilProtection = {
[TEAM_POLICE] = true,
[TEAM_CHIEF] = true,
[TEAM_MAYOR] = true,
[TEAM_SWAT] = true,
[TEAM_SWATCOMMANDER] = true,
[TEAM_SWATBREACH] = true,
[TEAM_SNIPER] = true,
[TEAM_SECRET] = true,
[TEAM_UNDERCOVER] = true,
}
[/lua]
Do it to your heart’s content, and the cpcanarrestcp in the settings.lua will work as defined

Well, I’m stupid smh. I guess I didn’t bother to look down there =(

[editline]13th August 2015[/editline]

thanks for the code, but I didn’t realize there was a section that defined cp