DarkRP Arrest Stick Help

Can someone guide me on how to make it so the CP’s run faster when they take their arrest stick out?

if ply:GetActiveWeapon():GetClass() == “arreststickfoldername” then
– you get the picture
end

no i don’t get the picture, can you explain it a little better please?

:smiley:

:stuck_out_tongue: So basically, since i’m a nice guy.
[lua]
timer.Create(“checkarrestbaton”, 0.1, 0, function()–Made a timer to check every 0.1 seconds
for k,v in pairs(player.GetAll()) do – take all the players
if v:Alive() then – are we alive if yes continue
if (v:GetActiveWeapon():GetClass() == “arrest_stick” and v:Team() == TEAM_POLICE) then – if our wep is the ArrestStick and we are cp continue
v:SetRunSpeed(500) – change to w/e runspeed
else --if we arnt all that stuff^
v:SetRunSpeed(200) – change run speed to this
end – end the if
end – so on
end
end)
[/lua]

I think it’d be better if the SetRunSpeed() lines were handled in the SWEP’s deploy and holster functions, and perhaps in OnRemove and OwnerChanged as well.

For instance:

[lua]function SWEP:Holster()
self.Owner:SetRunSpeed(200)
return true
end

function SWEP:Deploy()
self.Owner:SetRunSpeed(500)
end[/lua]

That could be a second option, I suppose.
But by the contents of his request he said specifically the CP and from the looks of your code you only included who has the baton.