• Client to Server Hook?
    1 replies, posted
I'm trying to make a screen pop up until the user clicks (haven't coded that bit yet) but i can't get the menu to even pop up on player spawn, i've tried tons of things (as you can see through the commenting out) but i still can't get it to work? Server File: function startScreen(ply) --umsg.Start("startLoginScreen",ply) --umsg.End() print( ply:Name() .. " has spawned !!!" ) hook.Call("testHook") hook.Run("testHook") end hook.Add("PlayerSpawn","startLoginScreenInit",startScreen) Client File: local blur = Material( "pp/blurscreen" ) function loginScreen() surface.SetDrawColor( 255, 255, 255, 100 ) surface.SetMaterial( blur ) for i = 1, 3 do blur:SetFloat( "$blur", ( i / 10 ) * 20 ) blur:Recompute() render.UpdateScreenEffectTexture() surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() ) end draw.RoundedBox(0, ScrW() /2, ScrH() /2, 350 + 5, 24, Color(255,255,255,255)) end hook.Add("testHook","startLoginScreen", loginScreen) --usermessage.Hook("startLoginScreen", loginScreen) --hook.Run( "startLoginScreen", loginScreen ) --hook.Call("startLoginScreen") I'm obviously new to all of this, so sorry if it's a stupid question/easy fix. EXTRA: The hud doesn't seem to turn off when commenting out the "HUDPaint" hook i'm using for testing purposes? Thanks in advance
That's because it never gets removed. If you reload gmod or even just changelevel after commenting out the hook, you'll see that it's gone. Or you can use hook.Remove. As for the first issue, try reading this page: States (it's very short) And then this one: Net Library Usage It's expected that you won't get it right the first time, but it might lead you to understand the situation a bit better, then you can ask more specifically what you don't understand!
Sorry, you need to Log In to post a reply to this thread.