mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-01 18:58:54 +00:00
Fixed invisable bug once and for all, closes #13
This commit is contained in:
+11
-7
@@ -176,16 +176,16 @@ Citizen.CreateThread(function()
|
||||
if instance.host then
|
||||
-- Get players and sets them as pairs
|
||||
for k,v in ipairs(GetActivePlayers()) do
|
||||
playersToHide[v] = true
|
||||
playersToHide[GetPlayerServerId(v)] = true
|
||||
end
|
||||
|
||||
-- Dont set our instanced players invisible
|
||||
for _,player in ipairs(instance.players) do
|
||||
playersToHide[GetPlayerFromServerId(player)] = nil
|
||||
playersToHide[player] = nil
|
||||
end
|
||||
else
|
||||
for player,_ in pairs(instancedPlayers) do
|
||||
playersToHide[GetPlayerFromServerId(player)] = true
|
||||
playersToHide[player] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -197,10 +197,14 @@ Citizen.CreateThread(function()
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
-- Hide all these players
|
||||
for player,_ in pairs(playersToHide) do
|
||||
local otherPlayerPed = GetPlayerPed(player)
|
||||
SetEntityVisible(otherPlayerPed, false, false)
|
||||
SetEntityNoCollisionEntity(playerPed, otherPlayerPed, false)
|
||||
for serverId,_ in pairs(playersToHide) do
|
||||
local player = GetPlayerFromServerId(serverId)
|
||||
|
||||
if NetworkIsPlayerActive(player) then
|
||||
local otherPlayerPed = GetPlayerPed(player)
|
||||
SetEntityVisible(otherPlayerPed, false, false)
|
||||
SetEntityNoCollisionEntity(playerPed, otherPlayerPed, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -12,6 +12,12 @@ function GetInstancedPlayers()
|
||||
return players
|
||||
end
|
||||
|
||||
AddEventHandler('playerDropped', function(reason)
|
||||
if instances[source] then
|
||||
CloseInstance(source)
|
||||
end
|
||||
end)
|
||||
|
||||
function CreateInstance(type, player, data)
|
||||
instances[player] = {
|
||||
type = type,
|
||||
|
||||
Reference in New Issue
Block a user