Well, so i made this SWEP that can lock doors. It works like it should, but it gives me an error:
[code]
[ERROR] gamemodes/udgdm/entities/weapons/weapon_admin_stick/shared.lua:74: attempt to call method 'Fire' (a nil value)
1. unknown - gamemodes/udgdm/entities/weapons/weapon_admin_stick/shared.lua:74
[/code]
This is my code:
[code]
function SWEP:PrimaryAttack()
local doorent = self.Owner:GetEyeTrace().Entity
if doorent:GetClass() == "func_door" || doorent:GetClass() == "prop_door_rotating" || doorent:GetClass() == "func_door_rotating" then
doorent:Fire("lock", "", .5)
end
end
[/code]
Any help would be much appericated.
Do IsValid( doorent ) check too.
[QUOTE=Robotboy655;44201887]Do IsValid( doorent ) check too.[/QUOTE]
Thanks.
[editline]11th March 2014[/editline]
[QUOTE=SkitZz;44201947]Thanks.[/QUOTE]
Added the IsValid check, but it still gives me the exact same error.
Sorry, you need to Log In to post a reply to this thread.