[CODE]/*---------------------------------------------------------
Name: Door Meta Functions
Desc:
---------------------------------------------------------*/
local meta = FindMetaTable("Entity")
function meta:isKeysOwnable()
if not IsValid(self) then return false end
local class = self:GetClass()
if ((class == "func_door" or class == "func_door_rotating" or class == "prop_door_rotating") or
( self:IsVehicle() and (not IsValid(self:GetParent()) or not self:GetParent():IsVehicle()))) then
return true
end
return false
end
/*---------------------------------------------------------
Name: SWEP: Functions
Desc:
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
if not IsFirstTimePredicted() then return end
self:SetNextPrimaryFire( CurTime() + 0.3 )
local tr = self:GetOwner():GetEyeTrace()
local ent = tr.Entity
if ent:isKeysOwnable() then
ent:Fire( "lock" )
end
end[/CODE]
I've copy and pasted this from my old version that worked and now it's returning an error.
Even though it throws an error it still locks the door...
Here's the error
[CODE][ERROR] gamemodes/x/entities/weapons/keys/shared.lua:107: attempt to call me
thod 'Fire' (a nil value)
1. unknown - gamemodes/x/entities/weapons/keys/shared.lua:107[/CODE]
Sorry, you need to Log In to post a reply to this thread.