forked from SetzCrew/setz_spawnselector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
97 lines (89 loc) · 3.09 KB
/
client.lua
File metadata and controls
97 lines (89 loc) · 3.09 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
----------------[Setz Crew]----------------
------- Front end: ESCKaybeden ----------
---------- Back end: ra1der -------------
----- Discord: discord.gg/6drAg2vP55 ----
-------------------------------------------
local ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj)
ESX = obj
end)
Wait(0)
end
end)
RegisterCommand('spawnselector', function()
if Config.Command == true then
TriggerEvent('setz:spawnselector_open')
end
end)
RegisterNetEvent('setz:spawnselector_open')
AddEventHandler('setz:spawnselector_open', function()
SetNuiFocus(true, true)
SendNUIMessage({
msg = "opens"
})
end)
RegisterNUICallback('selectspawn', function(data)
spawnplayer(data.secilenyer)
end)
function spawnplayer(datas)
local Player = PlayerPedId()
if datas == 'LastLocation' then
ESX.TriggerServerCallback("setz:spawnselector:lastlocation",function(data)
DoScreenFadeOut(100)
SetEntityCoords(Player, data['x'], data['y'], data['z'])
SetEntityHeading(Player, data['heading'])
SetEntityMaxHealth(Player, 200)
SetEntityHealth(Player, 200)
Close()
Wait(350)
DoScreenFadeIn(1000)
CameraPos(data['x'], data['y'], data['z'])
end)
else
DoScreenFadeOut(100)
SetEntityCoords(Player, Config.SpawnSelector[datas])
SetEntityMaxHealth(Player, 200)
SetEntityHealth(Player, 200)
Close()
Wait(350)
DoScreenFadeIn(1000)
CameraPos(Config.SpawnSelector[datas][1], Config.SpawnSelector[datas][2], Config.SpawnSelector[datas][3])
end
end
function Close()
SetNuiFocus(false, false)
SendNUIMessage({
msg = "Close"
})
end
function CameraPos(x,y,z)
local pos = {x = x, y = y, z = z}
SetEntityCoords(PlayerPedId(), pos.x, pos.y, pos.z)
SetEntityMaxHealth(PlayerPedId(), 200)
SetEntityHealth(PlayerPedId(), 200)
DoScreenFadeIn(500)
SetTimecycleModifier('default')
SetNuiFocus(false, false)
Citizen.Wait(500)
local cam2 = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -1355.93,-1487.78,520.75, 300.00,0.00,0.00, 100.00, false, 0)
PointCamAtCoord(cam2, pos.x,pos.y,pos.z+200)
SetCamActiveWithInterp(cam2, cam, 900, true, true)
Citizen.Wait(900)
local cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", pos.x,pos.y,pos.z+200, 300.00,0.00,0.00, 100.00, false, 0)
PointCamAtCoord(cam, pos.x,pos.y,pos.z+2)
SetCamActiveWithInterp(cam, cam2, 3700, true, true)
Citizen.Wait(3700)
PlaySoundFrontend(-1, "Zoom_Out", "DLC_HEIST_PLANNING_BOARD_SOUNDS", 1)
RenderScriptCams(false, true, 500, true, true)
PlaySoundFrontend(-1, "CAR_BIKE_WHOOSH", "MP_LOBBY_SOUNDS", 1)
FreezeEntityPosition(PlayerPedId(), false)
DoScreenFadeOut(500)
Citizen.Wait(500)
DoScreenFadeIn(1000)
SetCamActive(cam, false)
DestroyCam(cam, true)
DisplayHud(true)
DisplayRadar(true)
end