• Keypad cracker compatible with wire keypad
    11 replies, posted
Ive tried using or statements, and i used elseif as a second try, The cracker loads, you can spawn it, etc but when you try to crack a keypad, it wont crack them lol, can anyone explain what i did wrong? [code]if (SERVER) then AddCSLuaFile("shared.lua") end if (CLIENT) then SWEP.PrintName = "Keypad Cracker Development" SWEP.Slot = 4 SWEP.SlotPos = 1 SWEP.DrawAmmo = false SWEP.DrawCrosshair = true end -- Variables that are used on both client and server SWEP.Author = "Chief Tiger" SWEP.Instructions = "Left click to crack a keypad" SWEP.Contact = "" SWEP.Purpose = "" SWEP.ViewModelFOV = 62 SWEP.ViewModelFlip = false SWEP.ViewModel = Model("models/weapons/v_c4.mdl") SWEP.WorldModel = Model("models/weapons/w_c4.mdl") SWEP.Spawnable = false SWEP.AdminSpawnable = true SWEP.Sound = Sound("weapons/deagle/deagle-1.wav") SWEP.Primary.ClipSize = -1 -- Size of a clip SWEP.Primary.DefaultClip = 0 -- Default number of bullets in a clip SWEP.Primary.Automatic = false -- Automatic/Semi Auto SWEP.Primary.Ammo = "" SWEP.Secondary.ClipSize = -1 -- Size of a clip SWEP.Secondary.DefaultClip = -1 -- Default number of bullets in a clip SWEP.Secondary.Automatic = false -- Automatic/Semi Auto SWEP.Secondary.Ammo = "" SWEP.KeyCrackTime = 30 /*--------------------------------------------------------- Name: SWEP:Initialize() Desc: Called when the weapon is first loaded ---------------------------------------------------------*/ function SWEP:Initialize() if (SERVER) then self:SetWeaponHoldType("normal") end end /*--------------------------------------------------------- Name: SWEP:PrimaryAttack() Desc: +attack1 has been pressed ---------------------------------------------------------*/ function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire(CurTime() + .4) if self.IsCracking then return end local trace = self.Owner:GetEyeTrace() local e = trace.Entity if ValidEntity(e) and trace.HitPos:Distance(self.Owner:GetShootPos()) <= 300 and (e:GetClass() == "sent_keypad") then self.IsCracking = true self.StartCrack = CurTime() self.EndCrack = CurTime() + self.KeyCrackTime if SERVER then self:SetWeaponHoldType("pistol") timer.Create("KeyCrackSounds", 1, self.KeyCrackTime, function(wep) wep:EmitSound("buttons/blip2.wav", 100, 100) end, self) end if CLIENT then self.Dots = self.Dots or "" timer.Create("KeyCrackDots", 0.5, 0, function(wep) if not wep:IsValid() then timer.Destroy("KeyCrackDots") return end local len = string.len(wep.Dots) local dots = {[0]=".", [1]="..", [2]="...", [3]=""} wep.Dots = dots[len] end, self) end elseif ValidEntity(e) and trace.HitPos:Distance(self.Owner:GetShootPos()) <= 300 and (e:GetClass() == "sent_keypad_wire") then self.IsCracking = true self.StartCrack = CurTime() self.EndCrack = CurTime() + self.KeyCrackTime if SERVER then self:SetWeaponHoldType("pistol") timer.Create("KeyCrackSounds", 1, self.KeyCrackTime, function(wep) wep:EmitSound("buttons/blip2.wav", 100, 100) end, self) end if CLIENT then self.Dots = self.Dots or "" timer.Create("KeyCrackDots", 0.5, 0, function(wep) if not wep:IsValid() then timer.Destroy("KeyCrackDots") return end local len = string.len(wep.Dots) local dots = {[0]=".", [1]="..", [2]="...", [3]=""} wep.Dots = dots[len] end, self) end end end function SWEP:Holster() self.IsCracking = false if SERVER then timer.Destroy("KeyCrackSounds") end if CLIENT then timer.Destroy("KeyCrackDots") end return true end function SWEP:Succeed() self.IsCracking = false local trace = self.Owner:GetEyeTrace() if ValidEntity(trace.Entity) and trace.Entity:GetClass() == "sent_keypad" then local owner = trace.Entity:GetNWEntity("keypad_owner") owner:ConCommand("+gm_special " .. trace.Entity:GetNWInt("keypad_keygroup1") .. "\n") timer.Simple(trace.Entity:GetNWInt("keypad_length1"), function() owner:ConCommand("-gm_special " .. trace.Entity:GetNWInt("keypad_keygroup1") .. "\n")end) trace.Entity:SetNWBool("keypad_access", true) trace.Entity:SetNWBool("keypad_showaccess", true) if (SERVER) then trace.Entity:EmitSound("buttons/button11.wav") end timer.Simple(2, function() trace.Entity:SetNWBool("keypad_showaccess", false) end) elseif ValidEntity(trace.Entity) and trace.Entity:GetClass() == "sent_keypad_wire" then local owner = trace.Entity:GetNWEntity("keypad_owner") owner:ConCommand("+gm_special " .. trace.Entity:GetNWInt("keypad_keygroup1") .. "\n") timer.Simple(trace.Entity:GetNWInt("keypad_length1"), function() owner:ConCommand("-gm_special " .. trace.Entity:GetNWInt("keypad_keygroup1") .. "\n")end) trace.Entity:SetNWBool("keypad_access", true) trace.Entity:SetNWBool("keypad_showaccess", true) if (SERVER) then trace.Entity:EmitSound("buttons/button11.wav") end timer.Simple(2, function() trace.Entity:SetNWBool("keypad_showaccess", false) end) end if SERVER then timer.Destroy("KeyCrackSounds") end if CLIENT then timer.Destroy("KeyCrackDots") end end function SWEP:Fail() self.IsCracking = false if SERVER then self:SetWeaponHoldType("normal") timer.Destroy("KeyCrackSounds") end if CLIENT then timer.Destroy("KeyCrackDots") end end function SWEP:Think() if self.IsCracking then local trace = self.Owner:GetEyeTrace() if not ValidEntity(trace.Entity) then self:Fail() end if trace.HitPos:Distance(self.Owner:GetShootPos()) > 300 or (trace.Entity:GetClass() != "sent_keypad") then self:Fail() elseif trace.HitPos:Distance(self.Owner:GetShootPos()) > 300 or (trace.Entity:GetClass() != "sent_keypad_wire") then self:Fail() end if self.EndCrack <= CurTime() then self:Succeed() end end end[/code]
As first use [lua] tags, Then its ment to not be crackble, and as far i see, this one comes from Gmod.org of the version wich isnt used anymore.
[QUOTE=Dave_Parker;22103492]But since it's a serverside SWep he can just trigger the function and show it as accepted. Learn to apply logic before you post.[/QUOTE] As far i see his post, i cant say he knows any lua at all, so i dint even tryed. However, open up the keypad, check what it does when the user dioes the good pass, put that in the cracker, and wola!
[QUOTE=bromvlieg;22107178]As far i see his post, i cant say he knows any lua at all, so i dint even tryed. However, open up the keypad, check what it does when the user dioes the good pass, put that in the cracker, and wola![/QUOTE] first off, it's not that simple. second off, it's voila.
[QUOTE=trogdorian1;22166732]first off, it's not that simple. second off, it's voila.[/QUOTE] Why wouldn't it be that simple? In fact, why would it take anyone more then a minute to make?
I tried to do this, i did it but it took me a while. and you probbably have to edit the wire keypad(thats what i had to do)
[QUOTE=Tobba;22189251]I tried to do this, i did it but it took me a while. and you probbably have to edit the wire keypad(thats what i had to do)[/QUOTE] [lua] local Ent = KEYPAD_ENTITY_HERE // self.Entity:GetOwner():EyeTrace().HitEntity something like this? Wire_TriggerOutput(Ent, "Valid", 1) // Magicly turn his output to 1 Ent:SetNetworkedBool("keypad_access", true) // set acces to Yeh Ent:EmitSound("buttons/button9.wav") // emit sound Ent:SetNetworkedBool("keypad_showaccess", true) // show the message timer.Simple(2, function() // undo timer if Ent and Ent:IsValid() then Ent:SetNetworkedInt("keypad_num", 0) Ent:SetNetworkedBool("keypad_showaccess", false) Wire_TriggerOutput(Ent, "Valid", 0) // Magicly turn his output back to 0 end end) [/lua] I think ive done it?
Way to cheaty :v:, would probbably break something
[QUOTE=Tobba;22190147]Way to cheaty :v:, would probbably break something[/QUOTE] What can it brake? I do the acces, set the value, make the timer, set the acces to 0 again, and reset the value! If something breaks from that, then that person must recode it to work propper.
[QUOTE=Dave_Parker;22192150]You're quoting a post and still manage to spell break wrong :smithicide: ANYWAAAAY, You're not making the keypad's owner trigger the numpad (If not a wire keypad)[/QUOTE] Why the hell would you want to do that? if you would do that it wont be posible whitout editing! then you wil need to pass the password trugh, now it just trigers and opens! What diffrence does it make? he wants a keypad cracked, there you go! this wil openup keypads and close them, thats where he asked for!
Sorry, you need to Log In to post a reply to this thread.