mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 14:26:03 +01:00
feat(client): do not tp button after spawn
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
NDCore = exports["ND_Core"]:GetCoreObject()
|
NDCore = exports["ND_Core"]:GetCoreObject()
|
||||||
local changeAppearence = false
|
local changeAppearence = false
|
||||||
local started = false
|
local started = false
|
||||||
|
local firstSpawn = true
|
||||||
|
|
||||||
function startChangeAppearence()
|
function startChangeAppearence()
|
||||||
local config = {
|
local config = {
|
||||||
@@ -204,14 +205,28 @@ RegisterNUICallback("tpToLocation", function(data)
|
|||||||
if config.enableAppearance and changeAppearence then
|
if config.enableAppearance and changeAppearence then
|
||||||
startChangeAppearence()
|
startChangeAppearence()
|
||||||
end
|
end
|
||||||
|
if firstSpawn then
|
||||||
|
firstSpawn = false
|
||||||
|
SendNUIMessage({
|
||||||
|
type = "firstSpawn"
|
||||||
|
})
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Choosing the do not tp button.
|
-- Choosing the do not tp button.
|
||||||
RegisterNUICallback("tpDoNot", function(data)
|
RegisterNUICallback("tpDoNot", function(data)
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
local character = NDCore.Functions.GetCharacters()[data.id]
|
if firstSpawn then
|
||||||
if character.lastLocation and next(character.lastLocation) ~= nil then
|
local character = NDCore.Functions.GetCharacters()[data.id]
|
||||||
SetEntityCoords(ped, character.lastLocation.x, character.lastLocation.y, character.lastLocation.z, false, false, false, false)
|
if character.lastLocation and next(character.lastLocation) ~= nil then
|
||||||
|
SetEntityCoords(ped, character.lastLocation.x, character.lastLocation.y, character.lastLocation.z, false, false, false, false)
|
||||||
|
FreezeEntityPosition(ped, true)
|
||||||
|
end
|
||||||
|
firstSpawn = false
|
||||||
|
SendNUIMessage({
|
||||||
|
type = "firstSpawn"
|
||||||
|
})
|
||||||
|
else
|
||||||
FreezeEntityPosition(ped, true)
|
FreezeEntityPosition(ped, true)
|
||||||
end
|
end
|
||||||
SwitchInPlayer(ped)
|
SwitchInPlayer(ped)
|
||||||
|
|||||||
Reference in New Issue
Block a user