why is this invisible?
[lua]AddCSLuaFile("shared.lua")
ENT.PrintName = "Test"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Spawnable = true
ENT.AdminSpawnable = false
ENT.RenderGroup = RENDERGROUP_OPAQUE
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16 + Vector(0,0,150)
local ent = ents.Create( self.ClassName )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent
end
function ENT:Initialize()
if ( SERVER ) then
self:SetModel( "models/props_lab/tpplug.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
local phys = self:GetPhysicsObject()
if ( IsValid( phys ) ) then phys:Wake() end
end
end
[/lua]
You don't include shared.lua
Try this :
[LUA]
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.PrintName = "Test"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Spawnable = true
ENT.AdminSpawnable = false
ENT.RenderGroup = RENDERGROUP_OPAQUE
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16 + Vector(0,0,150)
local ent = ents.Create( self.ClassName )
ent:SetColor(255, 255, 255, 255);
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent
end
function ENT:Initialize()
if ( SERVER ) then
self:SetModel( "models/props_lab/tpplug.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
local phys = self:GetPhysicsObject()
if ( IsValid( phys ) ) then phys:Wake() end
end
end
[/LUA]
[QUOTE=Crazy Quebec;38420793]You don't include shared.lua[/QUOTE]
We have to have the file include itself now?
--' Shared.lua = Client-Server core
Init.lua = Server core
cl_Init.lua = Client core
This script must be in init.lua
[QUOTE=amkoc;38421932]We have to have the file include itself now?[/QUOTE]
My mistake, your file structure confused me. You should be including shared.lua in init.lua. AddCSLuaFile, Initialize and SpawnFunction also need to be in init.lua.
Sorry, you need to Log In to post a reply to this thread.