• Unlock all doors on a map when map is loading
    5 replies, posted
Can anybody make me a .lua script that unlocks ALL doors on the map when the map starts? Cause rp_downtown_v2 got a bug...most of the doors are locked.
[lua] hook.Add("InitPostEntity", "UnlockDoors", function() for k, v in pairs( ents.GetAll() ) do if v:GetClass() == "prop_door_rotating" then v:Fire("unlock") end end end ) [/lua]
[lua]local doors = { func_door = true, func_door_rotating = true, } hook.Add("InitPostEntity", "UnlockAllDoors", function() for _, ent in ipairs(ents.GetAll()) do if doors[ent:GetClass()] then ent:Fire("unlock") end end end)[/lua] [editline]05:44PM[/editline] :ninja:
[QUOTE=MakeR;21629554][lua]local doors = { func_door = true, func_door_rotating = true, } hook.Add("InitPostEntity", "UnlockAllDoors", function() for _, ent in ipairs(ents.GetAll()) do if doors[ent:GetClass()] then ent:Fire("unlock") end end end[/lua] [editline]05:44PM[/editline] :ninja:[/QUOTE] You're missing a ) on the last end :chef:
[QUOTE=CombineGuru;21629775]You're missing a ) on the last end :chef:[/QUOTE] FUUUUUUU thanks for pointing that out.
it somehow locked all doors, lol. what now? Edit: It works now, I removed the "local doors" thingy.
Sorry, you need to Log In to post a reply to this thread.