function playerDisconnected( ply )
for k,v in pairs( player.GetAll() ) do
v:PrintMessage( HUD_PRINTTALK, ply:Nick() .. " has disconnected. Their SteamID is: " .. tostring( ply:SteamID() ) "." )
end
end
hook.Add( "PlayerDisconnected", "leaveNotif", playerDisconnected )
I have a very simple code that's supposed to send a message to everyone when someone leaves, and giving their steamID. Right now, when someone leaves, I'm getting this in the server console:
Lua Error: [ERROR] addons/chatnotifications/lua/ulib/modules/player_disconnected.lua:5: attempt to call a string value
1. fn - addons/chatnotifications/lua/ulib/modules/player_disconnected.lua:5
2. unknown - addons/ulib/lua/ulib/shared/hook.lua:110So I figured it had to do with the SteamID() part, so when I removed that it worked fine (said "name" has disconnected.) but then I put the ply:SteamID() back in and it didn't work. So I tried doing tostring( ply:SteamID() ) but that doesn't work either.. what do I do?