[lua]
local ent = ents.Create("prop_physics")
ent:SetModel("models/myproject/mymodel.mdl")
ent:SetPos(LocalPlayer():GetPos() + Vector(0,12,0))
ent:Spawn()
Msg("ID: "..ent:EntIndex().."\n")
[/lua]
Msg outputs: -1
"ent" returns NULL Entity
I really don't get why it doesn't work...
It perfectly works creating Server-Side.
and how a "predicted" entity works ? I know there a few entities predicted, such as the vehicles, player movement...
[QUOTE=|FlapJack|;27614832][b][url=http://wiki.garrysmod.com/?title=G.ClientsideModel]G.ClientsideModel [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb][/url][/b][/QUOTE]
Damn! How I haven't seen that function before!?
thanks anyway...
[b]edit:[/b]
Still doesn't work...
Clientside models are affected by the garbage collector, store them in a table or something.
Isn't that expected behavior? Ent indices are the same client and server-side so if you create a client-side only entity it gets an ent index of -1 to not mess up the system.
Does it error when you call :SetPos etc?
Yep, "Tried to use NULL Entity"
Sorry, you need to Log In to post a reply to this thread.