I’m having some problems with my client-side file not running.
sv_init includes sv_playerlogin.lua and that works fine, it prints that it has started.
However my cl_playerlogin doesn’t seem to be working.
What is the proper way to make sure cl_playerlogin is included with the client and what else do I need to do.
So far I’ve got include("…/…/sv_playerlogin.lua") in my sv_init.lua and sv_playerlogin.lua does include fine.
Then in sv_playerlogin.lua I’ve got : AddCSLuaFile( “cl_playerlogin.lua” ). Below is my sv_playerlogin.lua and when I log-in it does print “This has worked no 3” so I know the login works but… see below
print( "playerlogin.lua has been loaded." ) AddCSLuaFile( "cl_playerlogin.lua" ) util.AddNetworkString( "characterCreationScreen" ) util.AddNetworkString( "characterSelectionScreen" ) function playerExist( ply ) local steamID = ply:SteamID() local playerFound = sql.QueryValue( "SELECT * FROM characterdata WHERE unique_id = '" .. steamID .. "'" ) if playerFound != nil then return true else return false end print(tostring(playerFound)) end local function playerLogin( ply ) timer.Simple( 15, function() print("This has worked no 1") print(tostring( playerExist(ply) )) if playerExist( ply ) == false then net.Start( "characterCreationScreen" ) net.Broadcast() print("This has worked no 2") else net.Start( "characterCreationScreen" ) net.Broadcast() print("This has worked no 3") // this is the latest bit that happens, so it does get this far. end end ) end hook.Add( "PlayerInitialSpawn", "playerLogin", playerLogin ) print("playerlogin.lua has been loaded." )
but it doesn’t seem to send the net.Start as I don’t get the print from in cl_playerlogin.lua in the client console. Am I doing something wrong when including this file?
net.Receive( "characterCreationScreen", function() print("This has worked no 4.5") end )