DarkRP - Skyrim-esque lockpicking

Basically I got Skyrim from Tomelyr and got inspired to make this. It works pretty much exactly like the lockpick from skyrim


Heh I mentioned that skyrim/fallout esque lockpicking would help in darkrp in one of the general discussion threads about a week ago and whadda ya know, you just happened to have been making one.

This is really cool ! A lockpick that require skill rather than time is so much better.

Been looking for something like this for a while now, so for starters, thank you for creating this.
Second thing is, it’s free… Hallelujah!

I’ll be using this on my server and will happily give you credit for the addon.

Put it on the Coderhire cloning thread. I’m aware that something like this is being sold on SF.

Did you fix relying on the client so much? I’d love to use it if you have.

Yeah at the slight expense of responsiveness for getting the correct angle. When you move your lockpick it periodically sends the angle to the server for verification that you are within 10 degrees of the unlocking angle and then it tells the client to do hint-y stuff.

[lua]-- Click once on door = generate number
– Closes panel automatically
– Tries to force the angle
– Send unlock to the server, opens the door

local msgcol = Color(51, 153, 102)
local function message(msg)
chat.AddText(msgcol, "[Pick] ", tostring(msg))

if weapons.Get(“lockpick”).Author ~= “Exho” then message(“Not using Exho’s lockpick.”) return end

local function forceang(pick, num, callback)
message("Trying "…num)
net.WriteInt(num, 8)

-- angle can be between 15 and 165 and accepts intervals of 20
timer.Simple(0.2, function() -- could fail depending on connection
	if not pick:GetNWBool("lockpick_canTurn") then
		if num > 165 then
			message("Picking failed. (Exceeded maximum angle; Zerf is bad.)")
		forceang(pick, num + 20, callback)


local pick = LocalPlayer():GetWeapon(“lockpick”)
if not IsValid(pick) then message(“Get a lockpick, skrublord.”) return end

if pick.OldPrimaryAttack then pick.PrimaryAttack = pick.OldPrimaryAttack end
pick.OldPrimaryAttack = pick.PrimaryAttack

function pick:PrimaryAttack()
if IsValid(self.frame) then – Don’t want no panel
self.frame = nil
if not IsFirstTimePredicted() then return end
forceang(pick, 5, function(num)
message(“Forced angle! (It was around “…num…”)”)
not good enough

[editline]2nd May 2015[/editline]

the script forceably unlocks any door in a maximum of 1.6 seconds

Not to say that there’s no problem with that, but don’t servers generally restrict clientside lua scripts anyway? I haven’t played Gmod in a while though so Im probably missing some important detail here

In DarkRP sv_allowcslua is 1 by default. Besides, I can run my own code without sv_allowcslua and without any DLLs. Never trust the client.

Yeah I know thats still possible… Do you happen to have any better ideas? This addon, by nature, requires a lot of client input and trust which has left me in a bad place security wise.