I don't know if it's a known problem or not, but if you create a new SENT and then assign variables in the shared.lua file, they won't exist on the client, only on the server. This is the same with functions. You can't create custom clientside functions on the entity.
If you spawn a Bouncy Ball and run this serverside code, while looking at the ball:
[code]] lua_run print(Entity(1):GetEyeTrace().Entity.Base)
> print(Entity(1):GetEyeTrace().Entity.Base)...
base_anim
[/code]
You see it prints out the base entity name. Because it's assigned in the shared.lua file as
[lua]ENT.Base = "base_anim"[/lua]
If you do this clientside:
[code]
] lua_run_cl print(LocalPlayer():GetEyeTrace().Entity.Base)
nil[/code]
You see it just prints out nil... I really need a way of assigning variables and functions to the SENT clientside. Is this a new problem or what? Anybody got any idea?
[QUOTE=Robbis_1;16978810]
If you spawn a Bouncy Ball and run this serverside code, while looking at the ball:
[...]
If you do this clientside:
[code]
] lua_run_cl print(LocalPlayer():GetEyeTrace().Entity.Base)
nil[/code]
You see it just prints out nil...[/QUOTE]
Works fine for me, it prints "base_anim" clientside too.
I have this problem with SNPCs though, for some reason I can't add any clientside variables or functions in the script-files, but it works fine with any other type of SENT.
[QUOTE=Silverlan;16980732]Works fine for me, it prints "base_anim" clientside too.
I have this problem with SNPCs though, for some reason I can't add any clientside variables or functions in the script-files, but it works fine with any other type of SENT.[/QUOTE]
Hm.. That's odd. But yes, I'm also working with SNPCs so that would be my main problem.
I have this problem too.. and it's really been bothering me lately..
Any workarounds? Anything?
[QUOTE=Robbis_1;17009203]Any workarounds? Anything?[/QUOTE]
Well, it works fine if you add the variables/functions after the SENT was created, so you could add a hook to "OnEntityCreated", check if it's your SENT, and then add all the clientside stuff in there.
That's a rather messy method though, but I can't think of anything else right now.
Sorry, you need to Log In to post a reply to this thread.