• WeaponBlackList Won't Work Properly.
    2 replies, posted
[B]Hey Lads[/B] I've been working/editing on this addon that's from scriptfodder which i purchased sometime ago but the developer left the project and there is no support from him. Basically it's a disguise swep that disguises you into another player this is for the DarkRP gamemode. [B]ScriptFodder Link: [/B][url]https://scriptfodder.com/scripts/view/563[/url] So Essentially, In his config.lua he had this line. (the purpose of this is that when disguised this swep can be used) [lua]disguise_WeaponBlacklist = {"keys"}[/lua] I added [lua]disguise_WeaponBlacklist = {"keys", "pocket", "weapon_physgun", "weapon_gravgun", "climb_swep2", "weapon_arc_atmcard", "gmod_camera"}[/lua] Doing this made not even the keys work like they originally did. This is a few lines from cl_disguisekit.lua (This lua file interacts with config.lua) [lua]hook.Add("KeyRelease", "RemoveDisHood", function(player , key) if ( LocalPlayer():Alive() ) then if ( key == IN_ATTACK ) and disguise_hasHUDopen then print("Stage 1") for k, v in pairs( disguise_WeaponBlacklist ) do if !( LocalPlayer():GetActiveWeapon():GetClass() == v) then hook.Remove("HUDPaint", "Swaggy Chickens") net.Start("ChangeBackDisGuse") net.WriteUInt(LocalPlayer():Team(), 32) net.SendToServer() disguise_hasHUDopen = false surface.PlaySound( "player/spy_disguise.wav" ) end end end end end)[/lua] I've spent hours trying to figure this out, if you know what's wrong please help me out. EDIT: disguise_WeaponBlacklist only seems to work with one swep. for example i can change it to this it will work [lua]disguise_WeaponBlacklist = {"weapon_physgun"}[/lua] but not [lua] disguise_WeaponBlacklist = {"weapon_physgun", 'keys"}[/lua]
It won't work, if you dont have the all weapons equipped, then it will not work. Fix: [CODE] hook.Add("KeyRelease", "RemoveDisHood", function(player , key) if ( LocalPlayer():Alive() ) then if ( key == IN_ATTACK ) and disguise_hasHUDopen then print("Stage 1") if !( disguise_WeaponBlacklist[LocalPlayer():GetActiveWeapon():GetClass()] ) then hook.Remove("HUDPaint", "Swaggy Chickens") net.Start("ChangeBackDisGuse") net.WriteUInt(LocalPlayer():Team(), 32) net.SendToServer() disguise_hasHUDopen = false surface.PlaySound( "player/spy_disguise.wav" ) end end end end) [/CODE] And [CODE] disguise_WeaponBlacklist = { ["keys"] = true, ["pocket"] = true, ["weapon_physgun"] = true, ["weapon_gravgun"] = true, ["climb_swep2"] = true, ["weapon_arc_atmcard"] = true, ["gmod_camera"] = true, } [/CODE]
I love you to death man cheers!!!
Sorry, you need to Log In to post a reply to this thread.