forked from hhfw1/cs_firstspawn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
377 lines (355 loc) · 13.9 KB
/
client.lua
File metadata and controls
377 lines (355 loc) · 13.9 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
local taxiVeh
local isTaxi = false
local Active = false
local sub_b0b5 = {
[0] = "MP_Plane_Passenger_1",
[1] = "MP_Plane_Passenger_2",
[2] = "MP_Plane_Passenger_3",
[3] = "MP_Plane_Passenger_4",
[4] = "MP_Plane_Passenger_5",
[5] = "MP_Plane_Passenger_6",
[6] = "MP_Plane_Passenger_7"
}
function sub_b747(ped, a_1)
if a_1 == 0 then
SetPedComponentVariation(ped, 0, 21, 0, 0)
SetPedComponentVariation(ped, 1, 0, 0, 0)
SetPedComponentVariation(ped, 2, 9, 0, 0)
SetPedComponentVariation(ped, 3, 1, 0, 0)
SetPedComponentVariation(ped, 4, 9, 0, 0)
SetPedComponentVariation(ped, 5, 0, 0, 0)
SetPedComponentVariation(ped, 6, 4, 8, 0)
SetPedComponentVariation(ped, 7, 0, 0, 0)
SetPedComponentVariation(ped, 8, 15, 0, 0)
SetPedComponentVariation(ped, 9, 0, 0, 0)
SetPedComponentVariation(ped, 10, 0, 0, 0)
SetPedComponentVariation(ped, 11, 10, 0, 0)
ClearPedProp(ped, 0)
ClearPedProp(ped, 1)
ClearPedProp(ped, 2)
ClearPedProp(ped, 3)
ClearPedProp(ped, 4)
ClearPedProp(ped, 5)
ClearPedProp(ped, 6)
ClearPedProp(ped, 7)
ClearPedProp(ped, 8)
elseif a_1 == 1 then
SetPedComponentVariation(ped, 0, 13, 0, 0)
SetPedComponentVariation(ped, 1, 0, 0, 0)
SetPedComponentVariation(ped, 2, 5, 4, 0)
SetPedComponentVariation(ped, 3, 1, 0, 0)
SetPedComponentVariation(ped, 4, 10, 0, 0)
SetPedComponentVariation(ped, 5, 0, 0, 0)
SetPedComponentVariation(ped, 6, 10, 0, 0)
SetPedComponentVariation(ped, 7, 11, 2, 0)
SetPedComponentVariation(ped, 8, 13, 6, 0)
SetPedComponentVariation(ped, 9, 0, 0, 0)
SetPedComponentVariation(ped, 10, 0, 0, 0)
SetPedComponentVariation(ped, 11, 10, 0, 0)
ClearPedProp(ped, 0)
ClearPedProp(ped, 1)
ClearPedProp(ped, 2)
ClearPedProp(ped, 3)
ClearPedProp(ped, 4)
ClearPedProp(ped, 5)
ClearPedProp(ped, 6)
ClearPedProp(ped, 7)
ClearPedProp(ped, 8)
elseif a_1 == 2 then
SetPedComponentVariation(ped, 0, 15, 0, 0)
SetPedComponentVariation(ped, 1, 0, 0, 0)
SetPedComponentVariation(ped, 2, 1, 4, 0)
SetPedComponentVariation(ped, 3, 1, 0, 0)
SetPedComponentVariation(ped, 4, 0, 1, 0)
SetPedComponentVariation(ped, 5, 0, 0, 0)
SetPedComponentVariation(ped, 6, 1, 7, 0)
SetPedComponentVariation(ped, 7, 0, 0, 0)
SetPedComponentVariation(ped, 8, 2, 9, 0)
SetPedComponentVariation(ped, 9, 0, 0, 0)
SetPedComponentVariation(ped, 10, 0, 0, 0)
SetPedComponentVariation(ped, 11, 6, 0, 0)
ClearPedProp(ped, 0)
ClearPedProp(ped, 1)
ClearPedProp(ped, 2)
ClearPedProp(ped, 3)
ClearPedProp(ped, 4)
ClearPedProp(ped, 5)
ClearPedProp(ped, 6)
ClearPedProp(ped, 7)
ClearPedProp(ped, 8)
elseif a_1 == 3 then
SetPedComponentVariation(ped, 0, 14, 0, 0)
SetPedComponentVariation(ped, 1, 0, 0, 0)
SetPedComponentVariation(ped, 2, 5, 3, 0)
SetPedComponentVariation(ped, 3, 3, 0, 0)
SetPedComponentVariation(ped, 4, 1, 6, 0)
SetPedComponentVariation(ped, 5, 0, 0, 0)
SetPedComponentVariation(ped, 6, 11, 5, 0)
SetPedComponentVariation(ped, 7, 0, 0, 0)
SetPedComponentVariation(ped, 8, 2, 0, 0)
SetPedComponentVariation(ped, 9, 0, 0, 0)
SetPedComponentVariation(ped, 10, 0, 0, 0)
SetPedComponentVariation(ped, 11, 3, 12, 0)
ClearPedProp(ped, 0)
ClearPedProp(ped, 1)
ClearPedProp(ped, 2)
ClearPedProp(ped, 3)
ClearPedProp(ped, 4)
ClearPedProp(ped, 5)
ClearPedProp(ped, 6)
ClearPedProp(ped, 7)
ClearPedProp(ped, 8)
elseif a_1 == 4 then
SetPedComponentVariation(ped, 0, 18, 0, 0)
SetPedComponentVariation(ped, 1, 0, 0, 0)
SetPedComponentVariation(ped, 2, 15, 3, 0)
SetPedComponentVariation(ped, 3, 15, 0, 0)
SetPedComponentVariation(ped, 4, 2, 5, 0)
SetPedComponentVariation(ped, 5, 0, 0, 0)
SetPedComponentVariation(ped, 6, 4, 6, 0)
SetPedComponentVariation(ped, 7, 4, 0, 0)
SetPedComponentVariation(ped, 8, 3, 0, 0)
SetPedComponentVariation(ped, 9, 0, 0, 0)
SetPedComponentVariation(ped, 10, 0, 0, 0)
SetPedComponentVariation(ped, 11, 4, 0, 0)
ClearPedProp(ped, 0)
ClearPedProp(ped, 1)
ClearPedProp(ped, 2)
ClearPedProp(ped, 3)
ClearPedProp(ped, 4)
ClearPedProp(ped, 5)
ClearPedProp(ped, 6)
ClearPedProp(ped, 7)
ClearPedProp(ped, 8)
elseif a_1 == 5 then
SetPedComponentVariation(ped, 0, 27, 0, 0)
SetPedComponentVariation(ped, 1, 0, 0, 0)
SetPedComponentVariation(ped, 2, 7, 3, 0)
SetPedComponentVariation(ped, 3, 11, 0, 0)
SetPedComponentVariation(ped, 4, 4, 8, 0)
SetPedComponentVariation(ped, 5, 0, 0, 0)
SetPedComponentVariation(ped, 6, 13, 14, 0)
SetPedComponentVariation(ped, 7, 5, 3, 0)
SetPedComponentVariation(ped, 8, 3, 0, 0)
SetPedComponentVariation(ped, 9, 0, 0, 0)
SetPedComponentVariation(ped, 10, 0, 0, 0)
SetPedComponentVariation(ped, 11, 2, 7, 0)
ClearPedProp(ped, 0)
ClearPedProp(ped, 1)
ClearPedProp(ped, 2)
ClearPedProp(ped, 3)
ClearPedProp(ped, 4)
ClearPedProp(ped, 5)
ClearPedProp(ped, 6)
ClearPedProp(ped, 7)
ClearPedProp(ped, 8)
elseif a_1 == 6 then
SetPedComponentVariation(ped, 0, 16, 0, 0)
SetPedComponentVariation(ped, 1, 0, 0, 0)
SetPedComponentVariation(ped, 2, 15, 1, 0)
SetPedComponentVariation(ped, 3, 3, 0, 0)
SetPedComponentVariation(ped, 4, 5, 6, 0)
SetPedComponentVariation(ped, 5, 0, 0, 0)
SetPedComponentVariation(ped, 6, 2, 8, 0)
SetPedComponentVariation(ped, 7, 0, 0, 0)
SetPedComponentVariation(ped, 8, 2, 0, 0)
SetPedComponentVariation(ped, 9, 0, 0, 0)
SetPedComponentVariation(ped, 10, 0, 0, 0)
SetPedComponentVariation(ped, 11, 3, 7, 0)
ClearPedProp(ped, 0)
ClearPedProp(ped, 1)
ClearPedProp(ped, 2)
ClearPedProp(ped, 3)
ClearPedProp(ped, 4)
ClearPedProp(ped, 5)
ClearPedProp(ped, 6)
ClearPedProp(ped, 7)
ClearPedProp(ped, 8)
end
end
RegisterNetEvent('cs:introCinematic:start', function()
local plyrId = PlayerPedId() -- PLAYER ID
local gender = IsPedMale(plyrId)
PrepareMusicEvent("FM_INTRO_START") --FM_INTRO_START
TriggerMusicEvent("FM_INTRO_START") --FM_INTRO_START
-----------------------------------------------
if gender then
RequestCutsceneWithPlaybackList("MP_INTRO_CONCAT", 31, 8)
else
RequestCutsceneWithPlaybackList("MP_INTRO_CONCAT", 103, 8)
end
while not HasCutsceneLoaded() do Wait(10) end --- waiting for the cutscene to load
if gender then
RegisterEntityForCutscene(0, 'MP_Male_Character', 3, GetEntityModel(PlayerPedId()), 0)
RegisterEntityForCutscene(PlayerPedId(), 'MP_Male_Character', 0, 0, 0)
SetCutsceneEntityStreamingFlags('MP_Male_Character', 0, 1)
local female = RegisterEntityForCutscene(0,"MP_Female_Character",3,0,64)
NetworkSetEntityInvisibleToNetwork(female, true)
else
RegisterEntityForCutscene(0, 'MP_Female_Character', 3, GetEntityModel(PlayerPedId()), 0)
RegisterEntityForCutscene(PlayerPedId(), 'MP_Female_Character', 0, 0, 0)
SetCutsceneEntityStreamingFlags('MP_Female_Character', 0, 1)
local male = RegisterEntityForCutscene(0,"MP_Male_Character",3,0,64)
NetworkSetEntityInvisibleToNetwork(male, true)
end
local ped = {}
for v_3=0, 6, 1 do
if v_3 == 1 or v_3 == 2 or v_3 == 4 or v_3 == 6 then
ped[v_3] = CreatePed(26, `mp_f_freemode_01`, -1117.77783203125, -1557.6248779296875, 3.3819, 0.0, 0, 0)
else
ped[v_3] = CreatePed(26, `mp_m_freemode_01`, -1117.77783203125, -1557.6248779296875, 3.3819, 0.0, 0, 0)
end
if not IsEntityDead(ped[v_3]) then
sub_b747(ped[v_3], v_3)
FinalizeHeadBlend(ped[v_3])
RegisterEntityForCutscene(ped[v_3], sub_b0b5[v_3], 0, 0, 64)
end
end
NewLoadSceneStartSphere(-1212.79, -1673.52, 7, 1000, 0) ----- avoid texture bugs
-----------------------------------------------
SetWeatherTypeNow("EXTRASUNNY") ---- SUN TIME
StartCutscene(4) --- START the custscene
Wait(34520) --- custscene time
for v_3=0, 6, 1 do
DeleteEntity(ped[v_3])
end
PrepareMusicEvent("AC_STOP")
TriggerMusicEvent("AC_STOP")
StopCutsceneImmediately()
DoScreenFadeOut(250)
Wait(2500)
if CodeStudio.useTaxi then
CreateTaxi(CodeStudio.TaxiSpawn)
else
DoScreenFadeIn(250)
SetEntityCoords(plyrId, CodeStudio.SpawnPedLoc)
end
end)
function CreateTaxiPed(vehicle)
local model = GetHashKey("a_m_y_stlat_01")
if DoesEntityExist(vehicle) then
if IsModelValid(model) then
RequestModel(model)
while not HasModelLoaded(model) do
Wait(1)
end
taxiPed = CreatePedInsideVehicle(vehicle, 26, model, -1, true, false)
SetAmbientVoiceName(ped, "A_M_M_EASTSA_02_LATINO_FULL_01")
SetBlockingOfNonTemporaryEvents(ped, true)
SetEntityAsMissionEntity(ped, true, true)
SetModelAsNoLongerNeeded(model)
end
end
end
function CreateTaxi(x, y, z)
local taxiModel = CodeStudio.Taxi
if IsModelValid(taxiModel) then
if IsThisModelACar(taxiModel) then
RequestModel(taxiModel)
while not HasModelLoaded(taxiModel) do
Wait(1)
end
if not DoesEntityExist(taxiVeh) then
PlaySoundFrontend(-1, "Text_Arrive_Tone", "Phone_SoundSet_Default", 1)
-- Wait(2000)
taxiVeh = CreateVehicle(taxiModel, x, y, z, CodeStudio.TaxiSpawn.w, true, false)
SetVehicleNumberPlateText(taxiVeh, CodeStudio.TaxiPlate)
SetEntityAsMissionEntity(taxiVeh, true, true)
SetVehicleEngineOn(taxiVeh, true, true, false)
if CodeStudio.TaxiModded then
SetVehicleColours(taxiVeh, 0,88)
SetVehicleModKit(taxiVeh, 0)
SetVehicleMod(taxiVeh,10,1,0)
end
SetVehicleOnGroundProperly(taxiVeh)
CreateTaxiPed(taxiVeh)
local blip = AddBlipForEntity(taxiVeh)
SetBlipSprite(blip, 198)
SetBlipFlashes(blip, true)
SetBlipFlashTimer(blip, 5000)
SetModelAsNoLongerNeeded(taxiModel)
SetHornEnabled(taxiVeh, true)
StartVehicleHorn(taxiVeh, 1000, GetHashKey("NORMAL"), false)
SetPedIntoVehicle(PlayerPedId(), taxiVeh, 2)
if IsPedInVehicle(PlayerPedId(), taxiVeh, 1) then
DoScreenFadeIn(250)
Notify(CodeStudio.WelcomeMessage)
SetVehicleDoorsLocked(taxiVeh, 4)
TaskVehicleDriveToCoord(taxiPed, taxiVeh, CodeStudio.TaxiDestination.x, CodeStudio.TaxiDestination.y, CodeStudio.TaxiDestination.z, CodeStudio.TaxiDestination.w, 0, GetEntityModel(taxiVeh), 524604, 10.0)
SetPedKeepTask(taxiPed, true)
Active = true
print(Active)
Wait(10000)
isTaxi = true
end
end
end
end
end
Citizen.CreateThread(function()
local sleep = 200
while true do
if Active then
local dist = #(GetEntityCoords(PlayerPedId()) - vector3(CodeStudio.TaxiDestination.x, CodeStudio.TaxiDestination.y, CodeStudio.TaxiDestination.z))
if dist <= 10 then
local player = PlayerPedId()
local vehicle = GetVehiclePedIsIn(player,false)
ClearPedTasks(player)
SetVehicleForwardSpeed(vehicle,19.0)
Wait(200)
SetVehicleForwardSpeed(vehicle,15.0)
Wait(200)
SetVehicleForwardSpeed(vehicle,11.0)
Wait(200)
SetVehicleForwardSpeed(vehicle,6.0)
Wait(200)
SetVehicleForwardSpeed(vehicle,0.0)
Notify(CodeStudio.ReachedMessage)
SetVehicleDoorsLocked(vehicle, 1)
SetPedKeepTask(taxiPed, false)
TaskLeaveVehicle(player, vehicle, 0)
Wait(2500)
DeleteTaxi(vehicle, taxiPed)
Active = false
isTaxi = false
end
if isTaxi then
sleep = 3
DisplayHelpText('Press ~INPUT_FRONTEND_RRIGHT~ Skip Drive')
if IsControlJustPressed(1, 194) then
local vehicle = GetVehiclePedIsIn(PlayerPedId(),false)
isTaxi = false
sleep = 200
DoScreenFadeOut(2500)
Wait(3000)
SetEntityCoords(vehicle, vector3(CodeStudio.SkipToNearestLoc.x, CodeStudio.SkipToNearestLoc.y, CodeStudio.SkipToNearestLoc.z))
SetEntityHeading(vehicle, CodeStudio.SkipToNearestLoc.w)
DoScreenFadeIn(250)
end
end
end
Wait(sleep)
end
end)
function DeleteTaxi(vehicle, driver)
if DoesEntityExist(vehicle) then
if IsPedInVehicle(PlayerPedId(), vehicle, false) then
TaskLeaveVehicle(PlayerPedId(), vehicle, 0)
Wait(2000)
end
local blip = GetBlipFromEntity(vehicle)
if DoesBlipExist(blip) then
RemoveBlip(blip)
end
DeleteEntity(driver)
DeleteEntity(vehicle)
end
if not DoesEntityExist(vehicle) and DoesEntityExist(driver) then
DeleteEntity(driver)
end
end
function DisplayHelpText(str)
SetTextComponentFormat("STRING")
AddTextComponentString(str)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end