Advertisement
Guest User

Untitled

a guest
May 31st, 2018
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. local sessionPlayers = {}
  2.  
  3. local function CallbackManager(callbackHandle, ...)
  4.     if(callbackHandle == Callback.EventLogged) then
  5.         local theEvent = ...   
  6.        
  7.         -- Player Manager
  8.         if(theEvent.type == "Player" and theEvent.name == "PlayerJoined") then
  9.             local playerRefID = theEvent.refid
  10.             local playerAttributes = theEvent.attributes
  11.             local playerName = playerAttributes.Name
  12.             local playerSteamID = playerAttributes.SteamId
  13.             table.insert(sessionPlayers, {playerRefID, playerName, playerSteamID})
  14.         end
  15.        
  16.         if(theEvent.type == "Player" and theEvent.name == "PlayerLeft") then
  17.             local playerRefID = theEvent.refid
  18.             local quitReason = theEvent.attributes.GameReasonId
  19.             for i=1, #sessionPlayers do
  20.                 if(sessionPlayers[i][1] == playerRefID) then
  21.                     table.remove(sessionPlayers, i)
  22.                     return
  23.                 end
  24.             end
  25.             if(quitReason == 2) then
  26.                 -- Kicked
  27.             end
  28.         end
  29.     end
  30. end
  31.  
  32. RegisterCallback(CallbackManager)
  33. EnableCallback(Callback.EventLogged)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement