Spawn Selector

Spawn at last location

function spwanAtLastLocation(data)
    local ped = PlayerPedId()
    local plrData = exports.sn_lib:getPlayerData()
    if not plrData then
        local SNPlayer = exports.sn_lib:getSNPlayerData(plrData.identifier)
        if SNPlayer and SNPlayer.interior then
            local interiorData = SNPlayer.interior
            if interiorData.property then
                local house = exports.getProperty(interiorData.property)
                if house and house.coords then
                    SetEntityCoords(ped, house.coords.x, house.coords.y, house.coords.z)
                    return
                end
            elseif interiorData.apartment then
                TriggerEvent('sn_apartment:client:enterApartment', interiorData.apartment, interiorData.room)
                return
            end
        end
    end
    TriggerServerEvent('sn_lib:server:updatePlayer', 'interior')
    -- run normal code
end

Last updated