Bug with instance

hi please help this plugin not work under onesync …
https://github.com/ESX-Org/instance

Have you changed loops to iterate over higher players?

1 Like

sure put it to 64 but seem no work …

i have also try 255 but not work too

What about Config.MaxPlayers?

Config = {}
Config.Locale = ‘fr’
Config.MaxPlayers = 64

and try

Config = {}
Config.Locale = ‘fr’
Config.MaxPlayers = 255

I fixed it using SetEntityVisible(otherPlayerPed, false, true) and SetEntityVisible(otherPlayerPed, false, false)

can you share you fix please ?

The reason for this is simply because the native does not work properly at the moment you want to add SetEntityVisble(entity, bool, 0)
wherever you want them to be invisible or visible, true for visible false for invisible. Hope this helps.
There you go please add this as the solution

-- Instance players
Citizen.CreateThread(function()
    while true do

        Citizen.Wait(0)

        if Instance.host ~= nil then

            local playerPed = PlayerPedId()

            for i=0, Config.MaxPlayers, 1 do

                local found = false
                for j=1, #Instance.players, 1 do
                    instancePlayer = GetPlayerFromServerId(Instance.players[j])

                    if i == instancePlayer then
                        found = true
                    end
                end

                if not found then
                    local otherPlayerPed = GetPlayerPed(i)

                    SetEntityLocallyInvisible(otherPlayerPed)
                    SetEntityVisible(otherPlayerPed, false, 0)
                    SetEntityNoCollisionEntity(playerPed, otherPlayerPed, true)
                end

            end

        else

            local playerPed = PlayerPedId()

            for i=0, Config.MaxPlayers, 1 do

                local found = false
                for j=1, #InstancedPlayers, 1 do
                    instancePlayer = GetPlayerFromServerId(InstancedPlayers[j])

                    if i == instancePlayer then
                        found = true
                    end
                end

                if found then
                    local otherPlayerPed = GetPlayerPed(i)

                    SetEntityLocallyInvisible(otherPlayerPed)
                    SetEntityVisible(otherPlayerPed, true, 0)
                    SetEntityNoCollisionEntity(playerPed, otherPlayerPed, true)
                end

            end

        end

    end
end)
7 Likes

yes but nop… when some one invte other people into the house and this guys leave and visite she show me but i don’t see him
it’s bugged

edit : seem to be my fault i have put the script from github and put you fix and yesit’s work great thanks :slight_smile:

There is a pull request from me on github as well for instance.

1 Like

Hello guys i have a problem with this script,

I though the main issue is the properties

bump everyone is getting invisible once the player entering apartment.

i got same error after i add this code

1 Like

same error

The problem I have is that when I enter two different properties, which have the same interior only, I can see the ID of another player in the other property, I can hear him speak and collide with him. Any solution for this?

Hello,
I have the same problem do you have fix ? thanks <3