-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathclient.lua
More file actions
54 lines (42 loc) · 1.08 KB
/
Copy pathclient.lua
File metadata and controls
54 lines (42 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
local ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj)
ESX = obj
end)
Citizen.Wait(0)
end
end)
RegisterNUICallback("spawnPlayer", function(data)
local Location = data["Location"]
SpawnPlayer(Location)
end)
SpawnPlayer = function(Location)
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Citizen.Wait(0)
end
SetNuiFocus(false, false)
if Config.SpawnPoints[Location] then
ESX.Game.Teleport(PlayerPedId(), Config.SpawnPoints[Location], function()
DoScreenFadeIn(500)
end)
else
if not ESX.PlayerData["lastPosition"] then
ESX.PlayerData["lastPosition"] = ESX.GetPlayerData()["lastPosition"]
end
ESX.Game.Teleport(PlayerPedId(), ESX.PlayerData["lastPosition"], function()
DoScreenFadeIn(500)
end)
end
end
RegisterCommand("andreas", function()
TriggerEvent("andreas_spawnlocation:setNui")
end)
RegisterNetEvent("andreas_spawnlocation:setNui")
AddEventHandler("andreas_spawnlocation:setNui", function()
SetNuiFocus(true, true)
SendNUIMessage({
["Action"] = "OPEN_SPAWNMENU"
})
end)