Hey there,
I was just wondering if anyone would be able to help me out with a issue im having with the main combine door on rp_tb_city45_v02n. The problem is that the door isn't openable by using 'e'. I have seen other topics about this but never really understood them as im fairly new to lua.
I tried this:
[QUOTE]function KeyPressedUse (ply, key)
local AllowedModels = {"models/player/police.mdl","models/player/breen.mdl"}
if !table.HasValue(AllowedModels,ply:GetModel()) then return end
if key == IN_USE then
local t = {}
t.start = ply:GetPos()
t.endpos = ply:GetShootPos() + ply:GetAimVector() * 100
t.filter = ply
local trace = util.TraceLine(t)
if trace.Entity and trace.Entity:IsValid() and (trace.Entity:GetClass() == "func_door" or trace.Entity:GetClass() == "prop_door_rotating" or trace.Entity:GetClass() == "prop_dynamic") then trace.Entity:Fire("Open")
trace.Entity:Fire("Open")
end
end
end
hook.Add( "KeyPress", "KeyPressedUse", KeyPressedUse )[/QUOTE]
and put it into orangebox/garrymod/lua/autorun/client/combine_door
but it doesnt seem to work.
Im not sure what went wrong but It didnt work, Could I get somebody to help me out please xD
That code is serverside, put it in autorun/server
Worked =D
Thanks man
Sorry, you need to Log In to post a reply to this thread.