#How to remove qb-spawns
1 messages · Page 1 of 1 (latest)
I thought i got banned or something
ssame lol
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
Just a sec let me check
kk
Give it a try.
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
I got confused earlier because of the closure of previous discord.
Did you follow the instructions i gave you on this new one ?
yes
Forget about the old one, and if you did follow the old instructions just undo them and follow only this
i did i just redid this and its still not working for some reason
Alright we ll figure it out. Give me a moment
thank you
I think this is what I missed.
Add this at the top of your code.
QBCore = exports['qb-core']:GetCoreObject()
okay so just copy everything in here?
Put this line of code at top of the first code i provided
where do i put it?
Qbcore server player.lua
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
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) ```
put that in where?
Qbcore server player.lua
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?
this
Delete everything and paste the last code
How does your server.cfg look like ?
want me to send you it?
Yeah that would be good
dms or here?
You can send it here
its not letting me in here
Dm then
Xd
i mean if you want i can let you login to vps and try youre self
I will dm you the whole qb spawns
k
You can delete the current qb spawns
if you go to qb-multicharacter and set the underlined line to true then it will auto spawn you at your last location
I guess so
we are so cooked
I didnt know that option even exsisted. Zog sorry for making things complicated lol
I guess its working now ?
yes!
Interesting
is it because i dont have a hud script in?
Ahh ok no worries 👍
Its resolved
@cerulean crescent please remember to tag this as Resolved when you have a moment 🙂
how do i dot hat
Right click edit tags
resolved isnt a tag