Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sessionPlayers = {}
- local function CallbackManager(callbackHandle, ...)
- if(callbackHandle == Callback.EventLogged) then
- local theEvent = ...
- -- Player Manager
- if(theEvent.type == "Player" and theEvent.name == "PlayerJoined") then
- local playerRefID = theEvent.refid
- local playerAttributes = theEvent.attributes
- local playerName = playerAttributes.Name
- local playerSteamID = playerAttributes.SteamId
- table.insert(sessionPlayers, {playerRefID, playerName, playerSteamID})
- end
- if(theEvent.type == "Player" and theEvent.name == "PlayerLeft") then
- local playerRefID = theEvent.refid
- local quitReason = theEvent.attributes.GameReasonId
- for i=1, #sessionPlayers do
- if(sessionPlayers[i][1] == playerRefID) then
- table.remove(sessionPlayers, i)
- return
- end
- end
- if(quitReason == 2) then
- -- Kicked
- end
- end
- end
- end
- RegisterCallback(CallbackManager)
- EnableCallback(Callback.EventLogged)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement