SetArmor based on jobs and undroppable weapons (DARKRP)

fixed just look down ^,^

For first one I would do something like:
[lua]
hook.Add(“PlayerSpawn”, “SomeUniqueName”, function(ply)
if ply:Team() == TEAM_CP then
ply:SetArmor( 15 )
elseif ply:Team() == TEAM_CHIEF then
ply:SetArmor( 25 )
elseif ply:Team() == TEAM_MAYOR then
ply:SetArmor( 50 )
else
ply:SetArmor( 0 )
end
end)
[/lua]

as for undroppable weapons, I don’t know. I would think it’s something like:
[lua]
hook.Add(“OnDrop”, “DontKnowIfWork”, function(ply)
SWEP:Equip()
end)
[/lua]

[lua]
function SpawnArmor(ply)

----- Edit Below This Line -----
local tarmor = {}
tarmor[1]={"Police",TEAM_POLICE,15} -- Syntax is Name,TeamName,ArmorAmmt
tarmor[2]={"Police Chief",TEAM_CHIEF,25} -- You can add and edit armor easily
tarmor[3]={"Mayor",TEAM_MAYOR,50}
----- Edit Above This Line -----

local t == ply:Team()

for a,b in pairs(tarmor) do
	if t == b[2] then
		ply:SetArmor(b[3])
		Notify(ply,1,4,"As a "..b[1].." you got "..b[3].." armor.")
	end
end

end
hook.Add(“PlayerSpawn”,“SpawnArmor”,SpawnArmor)
[/lua]

You can add this to the end of init.lua of you’re DarkRP files or in lua/autorun/server

Tried the Armor script,Uber and works thanks :slight_smile:

I also need a script… for someone can only go TEAM_MAYORGUARD when there is a TEAM_MAYOR

[editline]7th January 2011[/editline]

zacckkkk that one doesnt work and the one uber gave me works :slight_smile: please help me with the nodrop weapons

i dont want like the “lockpick” or the “keypad_cracker” etc…

For undroppable weapons:
Goes in main.lua
[lua]local NoDrop = {“add”, “weapons”, “here”} – Drop blacklist
local function DropWeapon(ply)
local ent = ply:GetActiveWeapon()
if not ValidEntity(ent) then return “” end

if GetConVarNumber("RestrictDrop") == 1 then
	local found = false
	for k,v in pairs(CustomShipments) do
		if v.entity == ent:GetClass() then
			found = true
			break
		end
	end
	
	if not found then
		Notify(ply, 1, 4, LANGUAGE.cannot_drop_weapon)
		return "" 
	end
end

if table.HasValue(NoDrop, ent:GetClass()) then return "" end

local RP = RecipientFilter()
RP:AddAllPlayers()

umsg.Start("anim_dropitem", RP) 
	umsg.Entity(ply)
umsg.End()
ply.anim_DroppingItem = true

timer.Simple(1, function(ply, ent) 
	if ValidEntity(ply) and ValidEntity(ent) and ent:GetModel() then 
		local ammohax = false
		local ammotype = ent:GetPrimaryAmmoType()
		local ammo = ply:GetAmmoCount( ammotype )
		local clip = ent.Primary.ClipSize
		if ammo <= clip then
			ammohax = true
		end
		ply:DropWeapon(ent) -- Drop it so the model isn't the viewmodel
		local weapon = ents.Create("spawned_weapon")
		local model = (ent:GetModel() == "models/weapons/v_physcannon.mdl" and "models/weapons/w_physics.mdl") or ent:GetModel()
		
		weapon.ShareGravgun = true
		weapon:SetPos(ply:GetShootPos() + ply:GetAimVector() * 30)
		weapon:SetModel(model)
		weapon:SetSkin(ent:GetSkin())
		weapon.weaponclass = ent:GetClass()
		weapon.nodupe = true
		weapon.ammohacked = ammohax
		weapon:Spawn()
		
		ent:Remove()
	end 
end, ply, ent)
return ""

end
AddChatCommand("/drop", DropWeapon)
AddChatCommand("/dropweapon", DropWeapon)
AddChatCommand("/weapondrop", DropWeapon)[/lua]

Try this perhaps:
[lua]
hook.Add(“PlayerJoinTeam”, “MayorGuard”, function(ply)
if ply:Team() == TEAM_MAYORGUARD then
if not ply:Team() == TEAM_MAYOR then
return false
else
return true
end
end
end)
[/lua]

i tried already Kaleb thats for shipments and uber ill try it in a bit people are actually playing on meh server :slight_smile:

[editline]8th January 2011[/editline]

uber your mayorscripts breaks server :frowning: made me lose everyone :frowning: x2

For the drop weapons thing you could use rp_restrictdrop 1 then in the f4 license menu any weapons that are checked get blocked from dropping.

Where would I add that hook that uber had posted up top?