I'm trying to edit this code to fix the problem I'm having. The code follows:
[CODE]function gcombat.validate( ent )
---> if (ent:GetPhysicsObject():IsValid() and !ent:IsPlayer() and ent:GetClass() != "wreckedstuff" and !ent:IsWorld() and !ent:IsWeapon() and string.find(ent:GetClass(), "func_") != 1 ) then <---
if ent.cbt then return true else gcombat.registerent(ent) end
return true
end
return false
end[/CODE]
And my problem with it is:
[CODE][addons\gcombat09\lua\autorun\server\sv_combatdamage.lua:16] attempt to index local 'ent' (a number value)
[/CODE]
I am not that good at LUA scripting, but I've a basic understanding of it.
Help is appreciated!
[QUOTE=Oirekdaman;34881895]I'm trying to edit this code to fix the problem I'm having. The code follows:
[CODE]function gcombat.validate( ent )
---> if (ent:GetPhysicsObject():IsValid() and !ent:IsPlayer() and ent:GetClass() != "wreckedstuff" and !ent:IsWorld() and !ent:IsWeapon() and string.find(ent:GetClass(), "func_") != 1 ) then <---
if ent.cbt then return true else gcombat.registerent(ent) end
return true
end
return false
end[/CODE]
And my problem with it is:
[CODE][addons\gcombat09\lua\autorun\server\sv_combatdamage.lua:16] attempt to index local 'ent' (a number value)
[/CODE]
I am not that good at LUA scripting, but I've a basic understanding of it.
Help is appreciated![/QUOTE]
This probably isn't the right section because there is a lua forum on facepunch.
But the problem with the script is the value coming in called 'ent' is not an entity. What ever is calling the method is sending it a number and not an entity.
[QUOTE=wilderbeast;34882330]This probably isn't the right section because there is a lua forum on facepunch.
But the problem with the script is the value coming in called 'ent' is not an entity. What ever is calling the method is sending it a number and not an entity.[/QUOTE]
Yeah I noticed that as soon as I posted, anyhow... I'm posting the code that precedes the one i posted.
[CODE]
COMBATDAMAGEENGINE = 1
gcombat = {}
function gcombat.registerent( ent, health, armor )
local h = ent:GetPhysicsObject():GetMass() * 4
ent.cbt = {};
ent.cbt.health = health or math.Clamp( h, 1, 4000 )
ent.cbt.armor = armor or 8
ent.cbt.maxhealth = health or math.Clamp( h, 1, 4000 )
end
function gcombat.validate( ent )
if (ent:GetPhysicsObject():IsValid() and !ent:IsPlayer() and ent:GetClass() != "wreckedstuff" and !ent:IsWorld() and !ent:IsWeapon() and string.find(ent:GetClass(), "func_") != 1 ) then
if ent.cbt then return true else gcombat.registerent(ent) end
return true
end
return false
end[/CODE]
I don't really see where the problem is :P
Add the following after function gcombat.validate(ent)
[lua]
if ( !ValidEntity(ent) ) then
return false;
end;
[/lua]
[QUOTE=Chessnut;34884165]Add the following after function gcombat.validate(ent)
[lua]
if ( !ValidEntity(ent) ) then
return false;
end;
[/lua][/QUOTE]
that solved that problem, but now I'm getting another error:
[CODE][lua\includes\util.lua:176] attempt to index local 'object' (a number value)
T[/CODE]
and I can't even find the file :S
Where is gcombat.validate() being called?
[QUOTE=Chessnut;34884452]Where is gcombat.validate() being called?[/QUOTE]
not sure what you're asking for... but I'll do my best
\addons\GCOMBAT09\lua\autorun\server\sv_combatdamage.lua
the script is trying to determine if the entity is a player or a prop or otherwise.
Sorry, you need to Log In to post a reply to this thread.