Advertisement
Guest User

Untitled

a guest
Dec 29th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. if CLIENT then
  2.  
  3.     local function playerDisconnect( um )
  4.         local ply = um.ReadEntity( um )
  5.         chat.AddText(Color(188,228,240), "Welcome " .. ply:Nick() .. " to the server!")
  6.     end
  7.  
  8.  
  9.     local function playerConnect( um )
  10.         local ply = um.ReadEntity( um )
  11.         chat.AddText(Color(219,86,46), ply:Nick() .. "has left the server.")
  12.     end
  13.  
  14.  
  15.     usermessage.Hook ( "playerDisconnect", playerDisconnect )
  16.     usermessage.Hook ( "playerConnect", playerConnect )
  17. end
  18.    
  19. if SERVER then
  20.  
  21.     local function onPlayerDisconnect( ply )
  22.         usmg.Start ( "playerDisconnect" )
  23.             usmg.Entity ( ply )
  24.     end
  25.  
  26.  
  27.     local function onPlayerConnect ( ply )
  28.         usmg.Start ( "playerConnect" )
  29.             usmg.Entity ( ply )
  30.     end
  31.  
  32.  
  33.     hook.Add ( "PlayerDisconnected", "PlyDC", onPlayerDisconnect )
  34.     hook.Add ( "PlayerSpawn", "PlyJoin", onPlayerConnect )
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement