• Mad Cows null entity lua error
    4 replies, posted
I am not a lua coder/have any experience with lua, so I came to ask it from you. Anyway, this error comes in frequently and I have no idea how it is not "valid entity" [ERROR] gamemodes/darkrp/entities/weapons/weapon_mad_base/shared.lua:717: Tried to use a NULL entity! 1. __index - [C]:-1 2. unknown - gamemodes/darkrp/entities/weapons/weapon_mad_base/shared.lua:717 This is what the code looks like in line 717: if not IsValid(self.Owner) then return end
For more information: This usually occurs when you die while shooting.
Here's what I do when I run into this. On the line above that, first check if self.Owner exists. [LUA] if !self.Owner then return end if not IsValid(self.Owner) then return end. [/LUA] IsVaild is freaking out because you're giving it a null entity.
[QUOTE=wranders;40441275]Here's what I do when I run into this. On the line above that, first check if self.Owner exists. [LUA] if !self.Owner then return end if not IsValid(self.Owner) then return end. [/LUA] IsVaild is freaking out because you're giving it a null entity.[/QUOTE] unfortunately that did not work and its saying the exactly same thing, tried removing the ! as well and had no effect, also removed the original and just put the upper line.... ill post lines 710-720 if thatll give oyu a lil more idea whats causing it.. [CODE] effectdata:SetStart(self.Owner:GetShootPos()) effectdata:SetNormal(self.Owner:GetAimVector()) effectdata:SetAttachment(1) // Add a timer to solve this problem : in multiplayer, when you aim with the ironsights, tracers, effects, etc. still come from where the barrel is when you don't aim with ironsights if ((game.SinglePlayer() and SERVER) or CLIENT) then timer.Simple(0, function() if not IsValid(self.Owner) then return end --problematic line 717 if (not IsFirstTimePredicted() or not self.Owner:Alive())then return end if (self.Shotgun) then[/CODE]
[QUOTE=jyrki5000;40442903]unfortunately that did not work and its saying the exactly same thing, tried removing the ! as well and had no effect[/QUOTE] Wait what? (btw "!" is the same as "not"). That means it's not returning no matter whether self.Owner is null or not. Are you sure you have got your line numbers correct?
Sorry, you need to Log In to post a reply to this thread.