Changing Picklock Speed (DarkRP)

Greetings, FacePunch. I have been trying to make the picklock sweap and make it into a new swep called fast_lockpick for a Professional Thief class. I know I have to change 3 things in the shared.lua code of the lockpick weapon. I have 2 guesses right now:


self.Weapon:SetNextPrimaryFire(CurTime() + 2)

and


self.LockPickTime = math.Rand(10, 30)

since they get involved in the line


self.EndPick = CurTime() + self.LockPickTime

Anyways here is the complete part:


function SWEP:PrimaryAttack()
	self.Weapon:SetNextPrimaryFire(CurTime() + 2)
	if self.IsLockPicking then return end

	local trace = self.Owner:GetEyeTrace()
	local e = trace.Entity
	if SERVER and e.isFadingDoor then SendUserMessage("IsFadingDoor", self.Owner, e) end -- The fading door tool only sets isFadingDoor serverside, for the lockpick to work we need this to be set clientside too.
	if IsValid(e) and trace.HitPos:Distance(self.Owner:GetShootPos()) <= 100 and (e:IsDoor() or e:IsVehicle() or string.find(string.lower(e:GetClass()), "vehicle") or e.isFadingDoor) then
		self.IsLockPicking = true
		self.StartPick = CurTime()
		if SERVER then
			self.LockPickTime = math.Rand(10, 30)
			umsg.Start("lockpick_time", self.Owner)
				umsg.Entity(self)
				umsg.Long(self.LockPickTime)
			umsg.End()
		end

		self.EndPick = CurTime() + self.LockPickTime

It would be:


self.LockPickTime = math.Rand(10, 30)

Change to something like:


self.LockPickTime = math.Rand(5, 15)
--or 
self.LockPickTime = 10

(10, 30) I guess thats the time, 2 questions, what do the numbers mean or it doesnt matter? and the lower the numbers the faster the speed?

Math.Rand outputs a random number in between the 2 numbers placed in the parenthesis with decimals.

Math.Random is similar to math.Rand() but, it will be a whole number.

Yes, since I put math.Rand(5,15), it would choose a number with decimals in between 5 and 15. If you had it at (2,3), it would take 2-3 seconds to open it.

I find that math.Rand is better suited to this purpose.

Makes sense, thanks a lot Brandon :slight_smile:

No problem. If you need any quick help just add me on Steam.

Ok thanks again, just sent you request.

EDIT

woot nice profile pic.

Were do you put this script

Hahaha

Use this hook instead http://wiki.darkrp.com/index.php/Hooks/Shared/lockpickTime don’t edit core files