Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gIsConcealmentRunning = false
- local gConcealedNetPlayers = { }
- local gIgnoreMap = { }
- function InitConcealment(ignoreList)
- if #ignoreList > 0 then
- for _, ignoredNetPlayer in ipairs(ignoreList) do
- gIgnoreMap[ignoredNetPlayer] = true
- end
- end
- RunConcealment()
- end
- function RunConcealment()
- if gIsConcealmentRunning then
- return
- end
- gIsConcealmentRunning = true
- CreateThread(function()
- while true do
- local keepRunning = false
- if not IsHashMapEmpty(gConcealedNetPlayers) then
- keepRunning = true
- for playerNetId, _ in pairs(gConcealedNetPlayers) do
- if not gIsConcealmentRunning or gIgnoreMap[playerNetId] then
- NetworkConcealPlayer(playerIndex, false, false)
- gConcealedNetPlayers[playerNetId] = nil
- end
- end
- end
- if gIsConcealmentRunning then
- keepRunning = true
- for _, playerIndex in ipairs(GetActivePlayers()) do
- local playerNetId = GetPlayerServerId(playerIndex)
- local isConcealed = gConcealedNetPlayers[playerNetId] ~= nil
- if not isConcealed then
- if not gIgnoreMap[playerNetId] then
- NetworkConcealPlayer(playerIndex, true, true)
- gConcealedNetPlayers[playerNetId] = true
- end
- end
- end
- end
- if not keepRunning then
- break
- end
- Wait(500)
- end
- end)
- end
- function IsHashMapEmpty(hashMap)
- for _, _ in pairs(hashMap) do
- return false
- end
- return true
- end
Add Comment
Please, Sign In to add comment