This repository was archived by the owner on Apr 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
184 lines (153 loc) · 4.09 KB
/
main.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
-- NO TOUCHY, IF SOMETHING IS WRONG CONTACT KANERSPS! --
-- NO TOUCHY, IF SOMETHING IS WRONG CONTACT KANERSPS! --
-- NO TOUCHY, IF SOMETHING IS WRONG CONTACT KANERSPS! --
-- NO TOUCHY, IF SOMETHING IS WRONG CONTACT KANERSPS! --
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if NetworkIsSessionStarted() then
TriggerServerEvent('es:firstJoinProper')
TriggerEvent('es:allowedToSpawn')
return
end
end
end)
local loaded = false
local cashy = 0
local oldPos
local pvpEnabled = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
local pos = GetEntityCoords(GetPlayerPed(-1))
if(oldPos ~= pos)then
TriggerServerEvent('es:updatePositions', pos.x, pos.y, pos.z)
if(loaded)then
SendNUIMessage({
setmoney = true,
money = cashy
})
loaded = false
end
oldPos = pos
end
end
end)
local myDecorators = {}
RegisterNetEvent("es:setPlayerDecorator")
AddEventHandler("es:setPlayerDecorator", function(key, value, doNow)
myDecorators[key] = value
DecorRegister(key, 3)
if(doNow)then
DecorSetInt(GetPlayerPed(-1), key, value)
end
end)
local enableNative = {}
local firstSpawn = true
AddEventHandler("playerSpawned", function()
for k,v in pairs(myDecorators)do
DecorSetInt(GetPlayerPed(-1), k, v)
end
if enableNative[1] then
N_0xc2d15bef167e27bc()
SetPlayerCashChange(1, 0)
Citizen.InvokeNative(0x170F541E1CADD1DE, true)
SetPlayerCashChange(-1, 0)
end
if enableNative[2] then
SetMultiplayerBankCash()
Citizen.InvokeNative(0x170F541E1CADD1DE, true)
SetPlayerCashChange(0, 1)
SetPlayerCashChange(0, -1)
end
if pvpEnabled then
end
TriggerServerEvent('playerSpawn')
end)
RegisterNetEvent('es:setMoneyIcon')
AddEventHandler('es:setMoneyIcon', function(i)
SendNUIMessage({
seticon = true,
icon = i
})
end)
RegisterNetEvent('es:activateMoney')
AddEventHandler('es:activateMoney', function(e)
SendNUIMessage({
setmoney = true,
money = e
})
end)
RegisterNetEvent('es:displayMoney')
AddEventHandler('es:displayMoney', function(a)
enableNative[1] = true
-- Found by FiveM forum user @Lobix300
N_0xc2d15bef167e27bc()
SetPlayerCashChange(1, 0)
Citizen.InvokeNative(0x170F541E1CADD1DE, true)
SetPlayerCashChange(a, 0)
end)
RegisterNetEvent('es:displayBank')
AddEventHandler('es:displayBank', function(a)
enableNative[2] = true
-- Found by FiveM forum user @Lobix300
SetMultiplayerBankCash()
SetPlayerCashChange(0, 1)
Citizen.InvokeNative(0x170F541E1CADD1DE, true)
SetPlayerCashChange(0, a)
end)
RegisterNetEvent("es:addedMoney")
AddEventHandler("es:addedMoney", function(m, native)
if not native then
SendNUIMessage({
addcash = true,
money = m
})
else
Citizen.InvokeNative(0x170F541E1CADD1DE, true)
Citizen.InvokeNative(0x0772DF77852C2E30, math.floor(m), 0)
end
end)
RegisterNetEvent("es:removedMoney")
AddEventHandler("es:removedMoney", function(m, native, current)
if not native then
SendNUIMessage({
removecash = true,
money = m
})
else
Citizen.InvokeNative(0x170F541E1CADD1DE, true)
Citizen.InvokeNative(0x0772DF77852C2E30, -math.floor(m), 0)
end
end)
RegisterNetEvent('es:addedBank')
AddEventHandler('es:addedBank', function(m)
Citizen.InvokeNative(0x170F541E1CADD1DE, true)
Citizen.InvokeNative(0x0772DF77852C2E30, 0, math.floor(m))
end)
RegisterNetEvent('es:removedBank')
AddEventHandler('es:removedBank', function(m)
Citizen.InvokeNative(0x170F541E1CADD1DE, true)
Citizen.InvokeNative(0x0772DF77852C2E30, 0, -math.floor(m))
end)
RegisterNetEvent("es:setMoneyDisplay")
AddEventHandler("es:setMoneyDisplay", function(val)
SendNUIMessage({
setDisplay = true,
display = val
})
end)
RegisterNetEvent("es:enablePvp")
AddEventHandler("es:enablePvp", function()
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
for i = 0,32 do
if NetworkIsPlayerActive(i) then
SetCanAttackFriendly(GetPlayerPed(i), true, true)
NetworkSetFriendlyFireOption(true)
end
end
end
end)
end)