forked from DareToDoyle/D2D-Armour
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.lua
66 lines (57 loc) · 2.6 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
--MADE BY DareToDoyle#3835--
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj)
ESX = obj
end)
end
end)
RegisterNetEvent('D2D-Armor:Light')
AddEventHandler('D2D-Armor:Light', function()
local player = PlayerPedId()
ESX.Streaming.RequestAnimDict('clothingtie', function() -- Loads a animation Dictionary (catagory)
TaskPlayAnim(PlayerPedId(), 'clothingtie', 'try_tie_negative_a', 8.0, 2.0, 1200, 48, 10, 0, 0, 0) -- Plays a specific animation within the dictionary.
Citizen.Wait(200)
SendNUIMessage({sound = "bpvest", volume = 0.2}) -- Plays a sound in the UI folder.
SetPedComponentVariation(player, 9, 1, 0, 2) -- This means "ped, Clothing Type (bulletproof vest) , bulletproof vest 1 (/skin menu), bulletproof vest 2(/skin menu), unknown"
SetPedArmour(player, 25) -- Doesn't allow players to "stack" the armor.
end)
end)
RegisterNetEvent('D2D-Armor:Medium')
AddEventHandler('D2D-Armor:Medium', function()
local player = PlayerPedId()
ESX.Streaming.RequestAnimDict('clothingtie', function()
TaskPlayAnim(PlayerPedId(), 'clothingtie', 'try_tie_negative_a', 8.0, 2.0, 1200, 48, 10, 0, 0, 0)
Citizen.Wait(200)
SendNUIMessage({sound = "bpvest", volume = 0.2})
SetPedArmour(player, 50)
SetPedComponentVariation(player, 9, 1, 1, 2)
end)
end)
RegisterNetEvent('D2D-Armor:Heavy')
AddEventHandler('D2D-Armor:Heavy', function()
local player = PlayerPedId()
ESX.Streaming.RequestAnimDict('clothingtie', function()
TaskPlayAnim(PlayerPedId(), 'clothingtie', 'try_tie_negative_a', 8.0, 2.0, 1200, 48, 10, 0, 0, 0)
Citizen.Wait(200)
SendNUIMessage({sound = "bpvest", volume = 0.2})
SetPedArmour(player, 75)
SetPedComponentVariation(player, 9, 1, 2, 2)
end)
end)
RegisterNetEvent('D2D-Armor:Military')
AddEventHandler('D2D-Armor:Military', function()
local player = PlayerPedId()
ESX.Streaming.RequestAnimDict('clothingtie', function()
TaskPlayAnim(PlayerPedId(), 'clothingtie', 'try_tie_negative_a', 8.0, 2.0, 1200, 48, 10, 0, 0, 0)
Citizen.Wait(200)
SendNUIMessage({sound = "bpvest", volume = 0.2})
SetPedArmour(player, 100)
SetPedComponentVariation(player, 9, 1, 3, 2)
end)
end)
AddEventHandler('esx:onPlayerDeath', function(data)
SetPedComponentVariation(PlayerPedId(), 9, 0, 0, 0)
end)
--MADE BY DareToDoyle#3835--