-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.lua
144 lines (107 loc) · 4.14 KB
/
menu.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
-- RPFSTUDIO BODYGUARD 1.0 WIP
-- blips on the map
-- blip sur la carte
local blips = {
{title="valentine", id=1560611276, x=-360.20, 740.00, 116.00},
}
Citizen.CreateThread(function()
for _, info in pairs(blips) do
info.blip = Citizen.InvokeNative(0x554d9d53f696d002, info.id, info.x, info.y, info.z)
end
end)
-- Clothe shop
-- magasin de vetement
Citizen.CreateThread(function()
WarMenu.CreateMenu('guard', "Garde du corp")
WarMenu.SetSubTitle('guard', 'Louer son service')
WarMenu.CreateSubMenu('ped', 'guard', 'Garde du corp')
while true do
local ped = GetPlayerPed(-1)
local coords = GetEntityCoords(PlayerPedId())
if WarMenu.IsMenuOpened('guard') then
if WarMenu.MenuButton('Sont disponible', 'ped') then
end
WarMenu.Display()
elseif WarMenu.IsMenuOpened('ped') then
if WarMenu.Button('Appeler pour 2 $') then
TriggerServerEvent("buy:guard", 2)
end
WarMenu.Display()
elseif (Vdist(coords.x, coords.y, coords.z, -360.20, 740.00, 116.00) < 2.0) then
TriggerEvent("enter:guard")
if IsControlJustReleased(0, 0xC7B5340A) then
WarMenu.OpenMenu('guard')
end
end
Citizen.Wait(0)
end
end)
-- callback or?
RegisterNetEvent('cancel')
AddEventHandler('cancel', function()
SetTextScale(0.5, 0.5)
--SetTextFontForCurrentCommand(1)
local msg = "Tu as pas de cash !!!"
local str = Citizen.InvokeNative(0xFA925AC00EB830B9, 10, "LITERAL_STRING", msg, Citizen.ResultAsLong())
Citizen.InvokeNative(0xFA233F8FE190514C, str)
Citizen.InvokeNative(0xE9990552DEC71600)
end)
RegisterNetEvent('enter:guard')
AddEventHandler('enter:guard', function()
SetTextScale(0.5, 0.5)
--SetTextFontForCurrentCommand(1)
local msg = "Touche Entrée pour ouvrir le Menu"
local str = Citizen.InvokeNative(0xFA925AC00EB830B9, 10, "LITERAL_STRING", msg, Citizen.ResultAsLong())
Citizen.InvokeNative(0xFA233F8FE190514C, str)
Citizen.InvokeNative(0xE9990552DEC71600)
end)
-- save guard
RegisterNetEvent('loadguard')
AddEventHandler('loadguard', function(kek)
TriggerEvent("bart", true)
end)
---- spawn npc
local function PerformRequest(hash)
print("requesting model " .. hash)
RequestModel(hash, 0) -- RequestModel
local times = 1
print("requested " .. times .. " times")
while not Citizen.InvokeNative(0x1283B8B89DD5D1B6, hash) do -- HasModelLoaded
Citizen.InvokeNative(0xFA28FE3A6246FC30, hash, 0) -- RequestModel
times = times + 1
print("requested " .. times .. " times")
Citizen.Wait(0)
if times >= 100 then break end
end
end
function lePlayerModel(name)
local model = GetHashKey(name)
local player = PlayerId()
if not IsModelValid(model) then return end
PerformRequest(model)
if HasModelLoaded(model) then
-- SetPlayerModel(player, model, false)
Citizen.InvokeNative(0xED40380076A31506, player, model, false)
Citizen.InvokeNative(0x283978A15512B2FE, PlayerPedId(), true)
SetModelAsNoLongerNeeded(model)
end
end
RegisterNetEvent('bart')
AddEventHandler('bart', function(source, args)
CreateThread(function()
local model = `mp_male`
PerformRequest(model)
local x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), 0))
bart = CreatePed(model, x+2, y+2, z, 0.0, true, true, true, true)
Citizen.InvokeNative(0x283978A15512B2FE, bart, true)
SetPedOutfitPreset(bart, 38)
Citizen.Wait(500)
SetPedAsCharacter(bart, "bart")
Citizen.Wait(500)
PerformRequest("w_shotgun_doublebarrel01")
GiveWeapon(bart, "WEAPON_SHOTGUN_DOUBLEBARREL", 500, false, 1, false, 0.0)
SetModelAsNoLongerNeeded("w_shotgun_doublebarrel01")
Citizen.Wait(500)
SetPedAsGroupMember(bart, GetPedGroupIndex(PlayerPedId()))
end)
end)