Here is my code:
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self.SetModel("models/props/cs_militia/militiarock03.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
end
Then i get this error:
[ERROR] addons/ogn mining system/lua/entities/rock/init.lua:8: Tried to use a NULL entity!
1. SetModel - [C]:-1
2. unknown - addons/ogn mining system/lua/entities/rock/init.lua:8
3. Spawn - [C]:-1
4. SpawnFunction - gamemodes/base/entities/entities/base_entity/init.lua:70
5. Spawn_SENT - gamemodes/sandbox/gamemode/commands.lua:655
6. unknown - gamemodes/sandbox/gamemode/commands.lua:720
7. unknown - lua/includes/modules/concommand.lua:54
You currently have this:
self.SetModel("models/props/cs_militia/militiarock03.mdl")
When it's suppose to be this:
self:SetModel( "models/props/cs_militia/militiarock03.mdl" )
whats the difference?
bump?
Literally not possible, you must either be getting a new error or didn't update the code properly. You should post the most up to date code and error for more help.
As tehbiga said, it's not possible. You're saying this is error sign, so you're most likely missing the model or the server you're testing on.
init.lua:
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self.SetModel("models/props/cs_militia/militiarock03.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
end
shared.lua
ENT.Base = "base_gmodentity"
ENT.Type = "anim"
ENT.PrintName = "Mining Rock"
ENT.Author = "Origin Gaming (Sam)"
ENT.Spawnable = false
ENT.AdminSpawnable = true
cl_init.lua
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
self.SetModel("models/props/cs_militia/militiarock03.mdl")
Still haven't updated it, yet you expect it to work?
Are you using a custom model?
I had to restart my game for some reason as said above
That second snippet still uses a period instead of a colon. You need to use the colon.
Maybe it was null because you haven't loaded the model yet, hence restarting the game fixed it as the model finally "mounted" itself.
You're mixing up entities (NULL) and strings (models). The issue is probably from him not saving the file until the final reload.
Sorry, you need to Log In to post a reply to this thread.