I'm pretty sure LocalPlayer() is not supposed to be a [NULL Entity] when the PlayerAuthed() hook is called, but it seems like it is now.
Does any of you guys have a clue on what other hooks I could use from the server to make sure players have their LocalPlayer() set?
After the "PlayerInitialSpawn" hook is called, call whatever functions you need a frame after.
[QUOTE=brandonj4;42230430]After the "PlayerInitialSpawn" hook is called, call whatever functions you need a frame after.[/QUOTE]
Looked promising but it didn't work, calling it on the next frame still returns the NULL Entity. I'm using a 2 seconds timer to make it work but I'm pretty sure it will vary depending on clients.
I don't know if this will fit what you are trying, but it's how I know when to start sending the client information.
[lua]local function OnPlayerLoaded(ent)
if ent == LocalPlayer() then
hook.Remove('OnPlayerLoaded')
net.Start('net_cl_ready')
net.SendToServer()
end
end
hook.Add('OnEntityCreated','OnPlayerLoaded',OnPlayerLoaded)[/lua]
I put that in the client, and then just make a call to my hook on the server from the net.Receive.
[QUOTE=Revenge282;42235308]I don't know if this will fit what you are trying, but it's how I know when to start sending the client information.
[lua]local function OnPlayerLoaded(ent)
if ent == LocalPlayer() then
hook.Remove('OnPlayerLoaded')
net.Start('net_cl_ready')
net.SendToServer()
end
end
hook.Add('OnEntityCreated','OnPlayerLoaded',OnPlayerLoaded)[/lua]
I put that in the client, and then just make a call to my hook on the server from the net.Receive.[/QUOTE]
This is one of the workarounds, I'm just wondering if there was any implemented server-side hooks that would fire once the player's ents are loaded.
[QUOTE=CrashLemon;42235355]This is one of the workarounds, I'm just wondering if there was any implemented server-side hooks that would fire once the player's ents are loaded.[/QUOTE]
Not any built in. Just when the entity is created server side, which is well before the client is ready obviously.
EDIT: I just thought about PlayerLoadout. Maybe that would work even though it is called pretty late.
Sorry, you need to Log In to post a reply to this thread.