I have seen these scripts but not the one I'm looking for. Im looking for one that says...
[B][Server] [/B][M] DeeMoney07 has connected. SteamID: (Place SteamID)
The server Text and bracket would be red.
Does anyone have this lieing around that they would give me or one that would take little editing to do. I am not a good coder but I know a few things about lua.
Quick example, untested:
[lua]
if SERVER then
AddCSLuaFile()
util.AddNetworkString("chat_AddText")
chat = {}
function chat.AddText(...)
net.Start("chat_AddText")
net.WriteTable({...})
net.Broadcast()
end
hook.Add("PlayerInitialSpawn", "SteamIDDisplay", function(ply)
chat.AddText(Color(255,0,0), "[SERVER]", Color(255,255,255), ply:Nick().." has connected. SteamID: "..ply:SteamID())
end)
else
net.Receive("chat_AddText", function(len)
chat.AddText(unpack(net.ReadTable()))
end)
end
[/lua]
Thanks so much. Hate to ask for more but, I also need it for disconnect. I understand its not reliable but for both.
So same thing
[Server] [M] DeeMoney07 has connected. SteamID: (Place SteamID)
and then
[Server] [M] DeeMoney07 has disconnected. SteamID: (Place SteamID)
Much Appreciated.
[QUOTE=Deemoney77;41621637]Thanks so much. Hate to ask for more but, I also need it for disconnect. I understand its not reliable but for both.
So same thing
[Server] [M] DeeMoney07 has connected. SteamID: (Place SteamID)
and then
[Server] [M] DeeMoney07 has disconnected. SteamID: (Place SteamID)
Much Appreciated.[/QUOTE]
You can figure that out on your own.
[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index01a8.html"]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index01a8.html[/URL]
[QUOTE=brandonj4;41621647]You can figure that out on your own.
[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index01a8.html"]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index01a8.html[/URL][/QUOTE]
Fair enough, Ill give it a shot.
But if I fuck up im coming to you guys again. hhaha
[CODE]function FirstSpawn( ply )
PrintMessage( HUD_PRINTTALK,"Player " .. ply:Nick() .. "(" .. ply:SteamID() .. ") has joined the game." )
end
hook.Add( "PlayerInitialSpawn", "playerInitialSpawn", FirstSpawn )
function PlayerDisconnect( ply )
PrintMessage( HUD_PRINTTALK,"Player " .. ply:Nick() .. "(" .. ply:SteamID() .. ") has left the game." )
end
hook.Add( "PlayerDisconnected", "playerDisconnected", PlayerDisconnect )[/CODE]
there's a super basic one for you.
PlayerInitialSpawn is when they spawn in the server, not when they connect.
You'd be better of using the gameevent.Listen function to get when they connect to the server.
This will replace the default source engine connect/disconnect message.
[LUA]if SERVER then
gameevent.Listen("player_connect")
gameevent.Listen("player_disconnect")
hook.Add("player_connect", "ShowConnect", function( data )
PrintMessage( HUD_PRINTTALK, "Player "..data["name"].." ("..data["networkid"]..") has joined the game" )
end)
hook.Add("player_disconnect", "ShowDisconnect", function( data )
PrintMessage( HUD_PRINTTALK, "Player "..data["name"].." ("..data["networkid"]..") left the game ("..data["reason"]..")" )
end)
else
hook.Add("ChatText", "HideMSG", function( _, _, _, msg )
if msg == "joinleave" then return true end
end)
end
[/LUA]
EDIT: How is this dumb? He asked for something that showed on connect and disconnect, not when they first spawn in the server.
Sorry, you need to Log In to post a reply to this thread.