#How to remove qb-spawns

1 messages · Page 1 of 1 (latest)

steady cove
#

Alright we re back heh

cerulean crescent
#

yay

#

i was so confused what happened lol

steady cove
#

I thought i got banned or something

cerulean crescent
#

ssame lol

steady cove
#

Anyway. Let me just revise.

#

Qbcore/server/player.lua

    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if Player then
        local coords = GetEntityCoords(GetPlayerPed(src))
        Player.Functions.SetMetaData('lastcoords', {x = coords.x, y = coords.y, z = coords.z})
    end
end)

QBCore.Commands.Add('spawn', 'Spawn your character', {}, false, function(source, args)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if Player then
        local lastCoords = Player.PlayerData.metadata['lastcoords']
        if lastCoords then
            TriggerClientEvent('qb-spawn:client:spawnPlayer', src, lastCoords)
        else
            TriggerClientEvent('qb-spawn:client:chooseApartment', src)
        end
    end
end) ```
#

Qb spawn/client/main.lua

    DoScreenFadeOut(1000)
    Wait(1000)
    SetEntityCoords(PlayerPedId(), coords.x, coords.y, coords.z, false, false, false, true)
    DoScreenFadeIn(1000)
end) ```
#

This should make that for a new player who joins choose his apartment. When he logs off and logs back in he would be spawned where he was

cerulean crescent
#

good?

steady cove
#

Just a sec let me check

cerulean crescent
#

kk

steady cove
#

Give it a try.

cerulean crescent
#

kk

#

06:25:20 PM [ script:qb-core] SCRIPT ERROR: @qb-core/server/player.lua:670: attempt to index a nil value (field 'Commands')
06:25:20 PM [ script:qb-core] > fn (@qb-core/server/player.lua:670)

#

im getting this now

#

and it is still giving me the menu

steady cove
#

I got confused earlier because of the closure of previous discord.

Did you follow the instructions i gave you on this new one ?

cerulean crescent
#

yes

steady cove
#

Forget about the old one, and if you did follow the old instructions just undo them and follow only this

cerulean crescent
#

i did i just redid this and its still not working for some reason

steady cove
#

Alright we ll figure it out. Give me a moment

cerulean crescent
#

thank you

steady cove
cerulean crescent
#

okay so just copy everything in here?

steady cove
cerulean crescent
#

where do i put it?

steady cove
#

Qbcore server player.lua

cerulean crescent
#

im testing it rn

#

06:39:31 PM [ script:qb-core] SCRIPT ERROR: @qb-core/server/player.lua:673: attempt to index a nil value (field 'Commands')

#

getting this error

steady cove
#

if not QBCore.Commands then
    QBCore.Commands = {}
end

QBCore.Commands.Add('spawn', 'Spawn your character', {}, false, function(source, args)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if Player then
        local lastCoords = Player.PlayerData.metadata['lastcoords']
        if lastCoords then
            TriggerClientEvent('qb-spawn:client:spawnPlayer', src, lastCoords)
        else
            TriggerClientEvent('qb-spawn:client:chooseApartment', src)
        end
    end
end) ```
cerulean crescent
#

put that in where?

steady cove
#

Qbcore server player.lua

cerulean crescent
#

RegisterNetEvent('qb-spawn:client:spawnPlayer', function(coords)
DoScreenFadeOut(1000)
Wait(1000)
SetEntityCoords(PlayerPedId(), coords.x, coords.y, coords.z, false, false, false, true)
DoScreenFadeIn(1000)
end)

#

still this in client main?

steady cove
#

Delete everything and paste the last code

cerulean crescent
#

kk

steady cove
#

How does your server.cfg look like ?

cerulean crescent
#

want me to send you it?

steady cove
#

Yeah that would be good

cerulean crescent
#

dms or here?

steady cove
#

You can send it here

cerulean crescent
#

its not letting me in here

steady cove
#

Dm then

cerulean crescent
#

wait

#

there

steady cove
#

Let me ask you, did you restart the server ?

#

After applying the code

cerulean crescent
#

YES

#

caps

#

lol

steady cove
#

Xd

cerulean crescent
#

i mean if you want i can let you login to vps and try youre self

steady cove
#

I will dm you the whole qb spawns

cerulean crescent
#

k

steady cove
#

You can delete the current qb spawns

subtle burrow
#

if you go to qb-multicharacter and set the underlined line to true then it will auto spawn you at your last location

steady cove
#

Without the prompt for last location?

#

Damn you are right

cerulean crescent
#

WOW

#

I DID ALL THIS FOR NOTHING?

steady cove
#

I guess so

cerulean crescent
#

we are so cooked

steady cove
#

I didnt know that option even exsisted. Zog sorry for making things complicated lol

cerulean crescent
#

i didnt either lol

#

all good

steady cove
#

I guess its working now ?

cerulean crescent
#

why does my map show?

cerulean crescent
steady cove
cerulean crescent
#

is it because i dont have a hud script in?

steady cove
#

Maybe try deleting the fivem cache

#

Its fixed

#

He was missing qb hud

worn coyote
#

Ahh ok no worries 👍

steady cove
#

Its resolved

somber palm
#

@cerulean crescent please remember to tag this as Resolved when you have a moment 🙂

cerulean crescent
#

how do i dot hat

subtle burrow
cerulean crescent
#

resolved isnt a tag