-
Notifications
You must be signed in to change notification settings - Fork 6
/
client.lua
127 lines (113 loc) · 4.08 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
local holdingRiot = false
local usingRiot = false
local riotModel = "prop_riot_shield"
local riotanimDict = "missfinale_c2mcs_1"
local riotanimName = "fin_c2_mcs_1_camman"
local holdingRiot2 = false
local usingRiot2 = false
local riotModel2 = "prop_ballistic_shield"
local riotanimDict2 = "missfinale_c2mcs_1"
local riotanimName2 = "fin_c2_mcs_1_camman"
local actionTime = 10
local riot_net = nil
local soundDistance = 15
---------------------------------------------------------------------------
-- Toggling Riot2 --
---------------------------------------------------------------------------
RegisterNetEvent("Riot:ToggleBalRiot")
AddEventHandler("Riot:ToggleBalRiot", function()
if holdingRiot then
return
end
if not holdingRiot2 then
RequestModel(GetHashKey(riotModel2))
while not HasModelLoaded(GetHashKey(riotModel2)) do
Citizen.Wait(100)
end
RequestAnimDict(riotanimDict2)
while not HasAnimDictLoaded(riotanimDict2) do
Citizen.Wait(100)
end
local plyCoords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(PlayerId()), 0.0, 0.0, -5.0)
local riotspawned2 = CreateObject(GetHashKey(riotModel2), plyCoords.x, plyCoords.y, plyCoords.z, 1, 1, 1)
Citizen.Wait(1000)
local netid = ObjToNet(riotspawned2)
SetNetworkIdExistsOnAllMachines(netid, true)
NetworkSetNetworkIdDynamic(netid, true)
SetNetworkIdCanMigrate(netid, false)
AttachEntityToEntity(riotspawned2, GetPlayerPed(PlayerId()), GetPedBoneIndex(GetPlayerPed(PlayerId()), 45509), 0.35, 0.05, -0.1, 300.0, 180.0, 60.0, 1, 1, 1, 1, 0, 1)
riot_net = netid
holdingRiot2 = true
else
ClearPedSecondaryTask(GetPlayerPed(PlayerId()))
DetachEntity(NetToObj(riot_net), 1, 1)
DeleteEntity(NetToObj(riot_net))
riot_net = nil
holdingRiot2 = false
usingRiot2 = false
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if (holdingRiot2 == true) then
local ped = GetPlayerPed(-1)
SetPlayerMayNotEnterAnyVehicle(ped)
end
end
end)
---------------------------------------------------------------------------
-- Toggling Riot1 --
---------------------------------------------------------------------------
RegisterNetEvent("Riot:ToggleRiot")
AddEventHandler("Riot:ToggleRiot", function()
if holdingRiot2 then
return
end
if not holdingRiot then
RequestModel(GetHashKey(riotModel))
while not HasModelLoaded(GetHashKey(riotModel)) do
Citizen.Wait(100)
end
RequestAnimDict(riotanimDict)
while not HasAnimDictLoaded(riotanimDict) do
Citizen.Wait(100)
end
local plyCoords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(PlayerId()), 0.0, 0.0, -5.0)
local riotspawned = CreateObject(GetHashKey(riotModel), plyCoords.x, plyCoords.y, plyCoords.z, 1, 1, 1)
Citizen.Wait(1000)
local netid = ObjToNet(riotspawned)
SetNetworkIdExistsOnAllMachines(netid, true)
NetworkSetNetworkIdDynamic(netid, true)
SetNetworkIdCanMigrate(netid, false)
AttachEntityToEntity(riotspawned, GetPlayerPed(PlayerId()), GetPedBoneIndex(GetPlayerPed(PlayerId()), 45509), 0.35, 0.05, -0.1, 300.0, 180.0, 60.0, 1, 1, 1, 1, 0, 1)
riot_net = netid
holdingRiot = true
else
ClearPedSecondaryTask(GetPlayerPed(PlayerId()))
DetachEntity(NetToObj(riot_net), 1, 1)
DeleteEntity(NetToObj(riot_net))
riot_net = nil
holdingRiot = false
usingRiot = false
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if (holdingRiot == true) then
local ped = GetPlayerPed(-1)
SetPlayerMayNotEnterAnyVehicle(ped)
end
end
end)
function Notification(message)
SetNotificationTextEntry("STRING")
AddTextComponentString(message)
DrawNotification(0, 1)
end
function DisplayNotification(string)
SetTextComponentFormat("STRING")
AddTextComponentString(string)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end