Darkrp - ban weapons from Job

I’m running 2.4.3 and I was wondering if there is a way that I can have a certain job that is incapable of picking up weapons for rp purposes. Any help would be appreciated. thanks

Is there some sort of general name for weapons that I could put for the ent rather then just listing them all? I just don’t want this class to be able to pick up any weapons at all.



hook.Add( "PlayerCanPickupWeapon", ( ply,  ent )
	if not (IsValid(ply)  then return end
		if ply:Team()==TEAM_PET then return false end
end)


That code you have there will work just fine. You have the hook.Add syntax wrong though.

[editline]22nd October 2013[/editline]



hook.Add( "PlayerCanPickupWeapon", "InsertUniqueNameHere", function(ply,  ent)
	if not IsValid(ply) then return end
	if ply:Team()==TEAM_PET then return false end
end)


Hmmm… doesn’t seem to be working. I also tried this:


hook.Add( "PlayerCanPickupWeapon", "TeamCanPickUp", function(ply,  ent)
	if team.GetName(ply:Team()) == "PET" then return false end
end)

  1. Where did you put it?
  2. You sure team.GetName(ply:Team()) returns what you are checking for? print() it out.

In a file in autorun. How can I go about testing it?

How did you miss it?

I got that, just wasn’t sure I was doing it right. This is what I have. It doesn’t seem to be doing anything.


hook.Add( "PlayerCanPickupWeapon", "TeamCanPickUp", function(ply,  ent)
	if team.GetName(ply:Team()) == "PET" then return false end
	print()
end)

Omg, really? Why can’t you look up how print works?


print(team.GetName(ply:Team()), team.GetName(ply:Team()) == "PET")