-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.lua
120 lines (99 loc) · 3.09 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
local OutfitVar = Config.OutfitVariation
local BlipSize = Config.BlipSize
local PedCollision = Config.PedCollision
local keys = {
-- Letter E
["E"] = 0xCEFD9220,
}
local chatarra = Config.Chatarra
local function IsNearZone ( location )
local player = PlayerPedId()
local playerloc = GetEntityCoords(player, 0)
for i = 1, #location do
if #(playerloc - location[i]) < 2.2 then
return true, i
end
end
end
---- spawn ped
Citizen.CreateThread(function()
local hashModel = GetHashKey(Config.Ped)
-- Loading Model
if IsModelValid(hashModel) then
RequestModel(hashModel)
while not HasModelLoaded(hashModel) do
Wait(100)
end
end
-- Spawn Ped
for k, v in pairs(Config.Blips) do
local npc = CreatePed(hashModel, v.x, v.y, v.z, v.h, false, true, true, true)
Citizen.InvokeNative(0x283978A15512B2FE, npc, OutfitVar) -- SetRandomOutfitVariation
SetEntityNoCollisionEntity(PlayerPedId(), npc, PedCollision)
SetEntityCanBeDamaged(npc, false)
SetEntityInvincible(npc, true)
Wait(1000)
FreezeEntityPosition(npc, true) -- NPC can't escape
SetBlockingOfNonTemporaryEvents(npc, true) -- NPC can't be scared
end
end)
local function DisplayHelp( _message, x, y, w, h, enableShadow, col1, col2, col3, a, centre )
local str = CreateVarString(10, "LITERAL_STRING", _message, Citizen.ResultAsLong())
SetTextScale(w, h)
SetTextColor(col1, col2, col3, a)
SetTextCentre(centre)
if enableShadow then
SetTextDropshadow(1, 0, 0, 0, 255)
end
Citizen.InvokeNative(0xADA9255D, 10);
DisplayText(str, x, y)
end
Citizen.CreateThread( function()
WarMenu.CreateMenu('fence', 'Gold Exchange')
repeat
if WarMenu.IsMenuOpened('fence') then
for i = 1, #chatarra do
if WarMenu.Button(chatarra[i]['Text'], chatarra[i]['SubText'], chatarra[i]['Desc']) then
TriggerServerEvent('gold:vender', chatarra[i]['Param'])
-- WarMenu.CloseMenu()
end
if WarMenu.Button(chatarra[i]['Text2'], chatarra[i]['SubText2'], chatarra[i]['Desc2']) then
TriggerServerEvent('gold:revender', chatarra[i]['Param'])
-- WarMenu.CloseMenu()
end
end
WarMenu.Display()
end
Citizen.Wait(0)
until false
end)
Citizen.CreateThread(function()
while true do
local IsZone, IdZone = IsNearZone(Config.Coords)
if IsZone then
DisplayHelp(Config.Shoptext, 0.50, 0.95, 0.6, 0.6, true, 255, 255, 255, 255, true, 10000)
if IsControlJustPressed(0, keys['E']) then
WarMenu.OpenMenu('fence')
end
end
Citizen.Wait(0)
end
end)
RegisterNetEvent('UI:NotificaVenta')
AddEventHandler('UI:NotificaVenta', function( _message )
TriggerEvent("vorp:TipRight", _message, 100)
end)
Citizen.CreateThread(function()
while true do
if Config.BlipToggle == True then
Wait(1000)
else
for k, v in pairs(Config.Blips) do
local blip = N_0x554d9d53f696d002(1664425300, v.x, v.y, v.z)
SetBlipSprite(blip, Config.BlipSprite, 1)
SetBlipScale(blip, BlipSize)
Citizen.InvokeNative(0x9CB1A1623062F402, blip, Config.BlipName)
end
end
end
end)