Rather than hijacking a release thread with lots of code questions, you should take any questions you have to developers corner.
Splitting topic to keep it clean.
Personally, I would of rather him just post in the thread, but okay.
-----
All this was not tested, so it it doesn't work (and if it doesn't, I'll feel like a lua failure, because this is really easy..), just tell me.
CLIENT SIDE// client side apple
// Spawn
function player_spawn( data )
local name = data:ReadString()
local steamid = data:ReadString()
local teamcolour = team.GetColor(data:ReadShort())
chat.AddText( Color( 255, 0, 255 ), "[Server] ", teamcolour, name, Color( 255, 255, 255 ), " has joined in the server. Their SteamID is: "..steamid )
end
usermessage.Hook("player_spawn", player_spawn)
// Disconnect
function player_disconnect( data )
local name = data:ReadString()
local steamid = data:ReadString()
local teamcolour = team.GetColor(data:ReadShort())
chat.AddText( Color( 255, 0, 255 ), "[Server] ", teamcolour, name, Color( 255, 255, 255 ), " has left the server. Their SteamID is: "..steamid" )
end
usermessage.Hook("player_disconnect", player_disconnect)
SERVER SIDE// server side apple
AddCSLuaFile( "cl_player.lua" )
//Spawn
function FirstSpawn( ply )
timer.Simple( 3, function()
umsg.Start( "player_spawn")
umsg.String(ply:Nick())
umsg.String(ply:SteamID())
umsg.Short(ply:Team())
umsg.End()
Msg("Player " .. ply:Nick() .. " has joined the server.\n")
end)
end
hook.Add( "PlayerInitialSpawn", "playerInitialSpawn", FirstSpawn )
//Disconnect
function PlayerDisconnect( ply )
umsg.Start( "player_disconnect")
umsg.String(ply:Nick())
umsg.String(ply:SteamID())
umsg.Short(ply:Team())
umsg.End()
Msg("Player " .. ply:Nick() .. " has left the server.\n")
end
hook.Add( "PlayerDisconnected", "playerDisconnected", PlayerDisconnect )