-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.lua
337 lines (312 loc) · 10.5 KB
/
client.lua
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
local Keys = {
["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
}
-- Get the ESX library --
ESX = exports["es_extended"]:getSharedObject()
------- Pause Menu texte
function SetData()
players = {}
for _, player in ipairs(GetActivePlayers()) do
local ped = GetPlayerPed(player)
table.insert( players, player )
end
local name = GetPlayerName(PlayerId())
local id = GetPlayerServerId(PlayerId())
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"), 'FE_THDR_GTAO', '~r~Calico City~s~ | ID : ~p~'.. id ..'~w~')
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(100)
SetData()
end
end)
Citizen.CreateThread(function()
AddTextEntry("PM_PANE_LEAVE", "~r~Se déconnecter ~w~de~r~ Calico City")
end)
Citizen.CreateThread(function()
AddTextEntry("PM_PANE_QUIT", "Quitter ~y~FiveM 🐌")
end)
-- PiggyBack
local carry = {
InProgress = false,
targetSrc = -1,
type = "",
personCarrying = {
animDict = "missfinale_c2mcs_1",
anim = "fin_c2_mcs_1_camman",
flag = 49,
},
personCarried = {
animDict = "nm",
anim = "firemans_carry",
attachX = 0.27,
attachY = 0.15,
attachZ = 0.63,
flag = 33,
}
}
local function drawNativeNotification(text)
SetTextComponentFormat("STRING")
AddTextComponentString(text)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end
local function GetClosestPlayer(radius)
local players = GetActivePlayers()
local closestDistance = -1
local closestPlayer = -1
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
for _,playerId in ipairs(players) do
local targetPed = GetPlayerPed(playerId)
if targetPed ~= playerPed then
local targetCoords = GetEntityCoords(targetPed)
local distance = #(targetCoords-playerCoords)
if closestDistance == -1 or closestDistance > distance then
closestPlayer = playerId
closestDistance = distance
end
end
end
if closestDistance ~= -1 and closestDistance <= radius then
return closestPlayer
else
return nil
end
end
local function ensureAnimDict(animDict)
if not HasAnimDictLoaded(animDict) then
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Wait(0)
end
end
return animDict
end
RegisterCommand("porter",function(source, args)
if not carry.InProgress then
local closestPlayer = GetClosestPlayer(3)
if closestPlayer then
local targetSrc = GetPlayerServerId(closestPlayer)
if targetSrc ~= -1 then
carry.InProgress = true
carry.targetSrc = targetSrc
TriggerServerEvent("CarryPeople:sync",targetSrc)
ensureAnimDict(carry.personCarrying.animDict)
carry.type = "carrying"
else
drawNativeNotification("~r~No one nearby to carry!")
end
else
drawNativeNotification("~r~No one nearby to carry!")
end
else
carry.InProgress = false
ClearPedSecondaryTask(PlayerPedId())
DetachEntity(PlayerPedId(), true, false)
TriggerServerEvent("CarryPeople:stop",carry.targetSrc)
carry.targetSrc = 0
end
end,false)
RegisterNetEvent("CarryPeople:syncTarget")
AddEventHandler("CarryPeople:syncTarget", function(targetSrc)
local targetPed = GetPlayerPed(GetPlayerFromServerId(targetSrc))
carry.InProgress = true
ensureAnimDict(carry.personCarried.animDict)
AttachEntityToEntity(PlayerPedId(), targetPed, 0, carry.personCarried.attachX, carry.personCarried.attachY, carry.personCarried.attachZ, 0.5, 0.5, 180, false, false, false, false, 2, false)
carry.type = "beingcarried"
end)
RegisterNetEvent("CarryPeople:cl_stop")
AddEventHandler("CarryPeople:cl_stop", function()
carry.InProgress = false
ClearPedSecondaryTask(PlayerPedId())
DetachEntity(PlayerPedId(), true, false)
end)
Citizen.CreateThread(function()
while true do
if carry.InProgress then
if carry.type == "beingcarried" then
if not IsEntityPlayingAnim(PlayerPedId(), carry.personCarried.animDict, carry.personCarried.anim, 3) then
TaskPlayAnim(PlayerPedId(), carry.personCarried.animDict, carry.personCarried.anim, 8.0, -8.0, 100000, carry.personCarried.flag, 0, false, false, false)
end
elseif carry.type == "carrying" then
if not IsEntityPlayingAnim(PlayerPedId(), carry.personCarrying.animDict, carry.personCarrying.anim, 3) then
TaskPlayAnim(PlayerPedId(), carry.personCarrying.animDict, carry.personCarrying.anim, 8.0, -8.0, 100000, carry.personCarrying.flag, 0, false, false, false)
end
end
end
Wait(0)
end
end)
--- Put the train
Citizen.CreateThread(function()
SwitchTrainTrack(0, true)
SwitchTrainTrack(3, true)
N_0x21973bbf8d17edfa(0, 120000)
SetRandomTrains(true)
end)
-- DISABLE AUTO PLACE CHANGE
local disableShuffle = true
function disableSeatShuffle(flag)
disableShuffle = flag
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsPedInAnyVehicle(GetPlayerPed(-1), false) and disableShuffle then
if GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1), false), 0) == GetPlayerPed(-1) then
if GetIsTaskActive(GetPlayerPed(-1), 165) then
SetPedIntoVehicle(GetPlayerPed(-1), GetVehiclePedIsIn(GetPlayerPed(-1), false), 0)
end
end
end
end
end)
-- KEYBIND CHANGE PLACE VEHICLE
Citizen.CreateThread(function()
while true do
local plyPed = PlayerPedId()
if IsPedSittingInAnyVehicle(plyPed) then
local plyVehicle = GetVehiclePedIsIn(plyPed, false)
CarSpeed = GetEntitySpeed(plyVehicle) * 3.6 -- We define the speed of the vehicle in km/h
if CarSpeed <= 40.0 then -- You cannot change places if the speed of the vehicle is above or equal to 60 km/h
if IsControlJustReleased(0, 27) then -- driver --Click Molette
SetPedIntoVehicle(plyPed, plyVehicle, -1)
Citizen.Wait(10)
end
if IsControlJustReleased(0, 50) then -- Before right --Molette vers le bas
SetPedIntoVehicle(plyPed, plyVehicle, 0)
Citizen.Wait(10)
end
if IsControlJustReleased(0, 99) then -- back left --Molette vers le haut
SetPedIntoVehicle(plyPed, plyVehicle, 1)
Citizen.Wait(10)
end
if IsControlJustReleased(0, 83) then -- back left -- =
SetPedIntoVehicle(plyPed, plyVehicle, 2)
Citizen.Wait(10)
end
end
end
Citizen.Wait(10) -- Fix Crash Client
end
end)
--[[---------- disable pnj Carjacking
Citizen.CreateThread(function()
while true do
Wait(800)
local player = GetPlayerPed(-1)
local PlayerPedId = PlayerPedId(player)
local veh = GetVehiclePedIsTryingToEnter(PlayerPedId)
if veh ~= nil and DoesEntityExist(veh) then
local lockStatus = GetVehicleDoorLockStatus(veh)
if lockStatus == 7 then
SetVehicleDoorsLocked(veh, 2)
end
local ped = GetPedInVehicleSeat(veh, -1)
if ped then
SetPedCanBeDraggedOut(ped, false)
end
end
end
end)]]
-- Coup de cross
Citizen.CreateThread(function()
while true do
Citizen.Wait(100)
local ped = PlayerPedId()
if IsPedArmed(ped, 6) then
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(5)
if (not IsPedArmed(PlayerPedId(), 1)) and (GetSelectedPedWeapon(PlayerPedId()) ~= GetHashKey('weapon_unarmed')) then
DisableControlAction(0, 140, true)
DisableControlAction(0, 141, true)
DisableControlAction(0, 142, true)
end
end
end)
ESX = exports["es_extended"]:getSharedObject()
local player = GetPlayerPed(-1)
local coords = GetEntityCoords(player)
--------------- NoNPCEmergency
function DisableDispatch()
for a = 1, 15 do
EnableDispatchService(a, false)
end
end
function RemoveAudio()
DisablePoliceReports()
end
function RemoveWantedLevel()
if GetPlayerWantedLevel(PlayerId()) >= 1 then
SetPlayerWantedLevel(PlayerId(), 0, false)
SetPlayerWantedLevelNow(PlayerId(), false)
end
end
Citizen.CreateThread(function()
while true do
Wait(0)
for i = 1, 15 do
EnableDispatchService(i, false)
end
SetPlayerWantedLevel(PlayerId(), 0, false)
SetPlayerWantedLevelNow(PlayerId(), false)
SetPlayerWantedLevelNoDrop(PlayerId(), 0, false)
end
end)
--------------- KNOCKOUT
local knockedOut = false
local wait = 15
local count = 60
Citizen.CreateThread(function()
while true do
Citizen.Wait(5)
local myPed = GetPlayerPed(-1)
if IsPedInMeleeCombat(myPed) then
if GetEntityHealth(myPed) < 115 then
SetPlayerInvincible(PlayerId(), true)
SetPedToRagdoll(myPed, 1000, 1000, 0, 0, 0, 0)
ShowNotification("~r~Vous êtes K.O")
wait = 15
knockedOut = true
SetEntityHealth(myPed, 116)
end
end
if knockedOut == true then
SetPlayerInvincible(PlayerId(), true)
DisablePlayerFiring(PlayerId(), true)
SetPedToRagdoll(myPed, 1000, 1000, 0, 0, 0, 0)
ResetPedRagdollTimer(myPed)
if wait >= 0 then
count = count - 1
if count == 0 then
count = 60
wait = wait - 1
SetEntityHealth(myPed, GetEntityHealth(myPed)+4)
end
else
SetPlayerInvincible(PlayerId(), false)
knockedOut = false
end
end
end
end)
function ShowNotification(text)
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(false, false)
end