-
Notifications
You must be signed in to change notification settings - Fork 0
/
ac_c.lua
252 lines (220 loc) · 7.2 KB
/
ac_c.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
ESX = nil
local isDead = false
local instancewait = false
local newmoney, money, bank, newbank = 0, 0, 0, 0
local anticheat = true
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
while ESX.GetPlayerData().job == nil do
Citizen.Wait(10)
end
ESX.PlayerData = ESX.GetPlayerData()
end)
RegisterNetEvent('anticheese:anticheat')
AddEventHandler('anticheese:anticheat', function(data)
anticheat = data
end)
RegisterNetEvent('anticheese:legitmoney')
AddEventHandler('anticheese:legitmoney', function(data)
money = money+data
end)
RegisterNetEvent('anticheese:legitbank')
AddEventHandler('anticheese:legitbank', function(data)
bank = bank+data
end)
AddEventHandler('playerSpawned', function(spawn)
isDead = false
TriggerEvent('esx_policejob:unrestrain')
end)
AddEventHandler('esx:onPlayerDeath', function(data)
isDead = true
end)
BlacklistedWeapons = { -- weapons that will get people banned
"WEAPON_BALL",
"WEAPON_RAILGUN",
"WEAPON_GARBAGEBAG",
}
CageObjs = {
"prop_gold_cont_01",
"p_cablecar_s",
"stt_prop_stunt_tube_l",
"stt_prop_stunt_track_dwuturn",
}
Citizen.CreateThread(function()
while true do
Wait(30000)
TriggerServerEvent("anticheese:timer")
end
end)
AddEventHandler('instance:enter', function()
instancewait = true
end)
AddEventHandler('instance:leave', function()
instancewait = true
end)
Citizen.CreateThread(function() --Tp/NoClip check
Citizen.Wait(60000)
while anticheat do
Citizen.Wait(0)
if not isDead then --Check only if player if a live
if instancewait then
Citizen.Wait(10000)
instancewait = false
else
local ped = PlayerPedId()
local posx,posy,posz = table.unpack(GetEntityCoords(ped,true))
local still = IsPedStill(ped)
local vel = GetEntitySpeed(ped)
local ped = PlayerPedId()
local veh = IsPedInAnyVehicle(ped, true)
local speed = GetEntitySpeed(ped)
local para = GetPedParachuteState(ped)
local flyveh = IsPedInFlyingVehicle(ped)
local rag = IsPedRagdoll(ped)
local fall = IsPedFalling(ped)
local parafall = IsPedInParachuteFreeFall(ped)
SetEntityVisible(PlayerPedId(), true) -- make sure player is visible
Wait(3000) -- wait 3 seconds and check again
local more = speed - 9.0 -- avarage running speed is 7.06 so just incase someone runs a bit faster it wont trigger
local rounds = tonumber(string.format("%.2f", speed))
local roundm = tonumber(string.format("%.2f", more))
if not IsEntityVisible(PlayerPedId()) then
SetEntityHealth(PlayerPedId(), -100) -- if player is invisible kill him!
end
newx,newy,newz = table.unpack(GetEntityCoords(ped,true))
newPed = PlayerPedId() -- make sure the peds are still the same, otherwise the player probably respawned
if GetDistanceBetweenCoords(posx,posy,posz, newx,newy,newz) > 300 and still == IsPedStill(ped) and vel == GetEntitySpeed(ped) and ped == newPed and not instancewait then
TriggerServerEvent("AntiCheese:NoclipFlag", GetDistanceBetweenCoords(posx,posy,posz, newx,newy,newz))
end
if speed > 9.0 and not veh and (para == -1 or para == 0) and not flyveh and not fall and not parafall and not rag and not instancewait then
--dont activate this, its broken!
--TriggerServerEvent("AntiCheese:SpeedFlag", rounds, roundm) -- send alert along with the rounded speed and how much faster they are
end
end
end
end
end)
RegisterNetEvent('es:activateMoney')
AddEventHandler('es:activateMoney', function(data)
newmoney = data
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
money = xPlayer.money
bank = xPlayer.accounts[1].money
end)
Citizen.CreateThread(function() --Money Cheat check
Citizen.Wait(60000)
while true do
Citizen.Wait(0)
local ped = PlayerPedId()
Citizen.Wait(60000) -- wait 60 seconds and check again
newbank = ESX.PlayerData.accounts[1].money
if newmoney+newbank > money+bank+99999 then
TriggerServerEvent("AntiCheese:MoneyFlag", (newmoney-money))
end
money = newmoney
bank = newbank
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(60000)
local curPed = PlayerPedId()
local curHealth = GetEntityHealth( curPed )
SetEntityHealth( curPed, curHealth-2)
local curWait = math.random(10,150)
-- this will substract 2hp from the current player, wait 50ms and then add it back, this is to check for hacks that force HP at 200
Citizen.Wait(curWait)
if not IsPlayerDead(PlayerId()) then
if PlayerPedId() == curPed and GetEntityHealth(curPed) == curHealth and GetEntityHealth(curPed) ~= 0 then
TriggerServerEvent("AntiCheese:HealthFlag", false, curHealth-2, GetEntityHealth( curPed ),curWait )
elseif GetEntityHealth(curPed) == curHealth-2 then
SetEntityHealth(curPed, GetEntityHealth(curPed)+2)
end
end
if GetEntityHealth(curPed) > 400 then
TriggerServerEvent("AntiCheese:HealthFlag", false, GetEntityHealth( curPed )-200, GetEntityHealth( curPed ),curWait )
end
if GetPlayerInvincible( PlayerId() ) then -- if the player is invincible, flag him as a cheater and then disable their invincibility
TriggerServerEvent("AntiCheese:HealthFlag", true, curHealth-2, GetEntityHealth( curPed ),curWait )
SetPlayerInvincible( PlayerId(), false )
end
end
end)
-- prevent infinite ammo, godmode, invisibility and ped speed hacks
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
SetPedInfiniteAmmoClip(PlayerPedId(), false)
SetEntityInvincible(PlayerPedId(), false)
SetEntityCanBeDamaged(PlayerPedId(), true)
ResetEntityAlpha(PlayerPedId())
local fallin = IsPedFalling(PlayerPedId())
local ragg = IsPedRagdoll(PlayerPedId())
local parac = GetPedParachuteState(PlayerPedId())
if parac >= 0 or ragg or fallin then
SetEntityMaxSpeed(PlayerPedId(), 80.0)
else
SetEntityMaxSpeed(PlayerPedId(), 7.1)
end
end
end)
function ReqAndDelete(object, detach)
if DoesEntityExist(object) then
NetworkRequestControlOfEntity(object)
while not NetworkHasControlOfEntity(object) do
Citizen.Wait(1)
end
if detach then
DetachEntity(object, 0, false)
end
SetEntityCollision(object, false, false)
SetEntityAlpha(object, 0.0, true)
SetEntityAsMissionEntity(object, true, true)
SetEntityAsNoLongerNeeded(object)
DeleteEntity(object)
end
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(500)
local ped = PlayerPedId()
local handle, object = FindFirstObject()
local finished = false
repeat
Wait(1)
if IsEntityAttached(object) and DoesEntityExist(object) then
if GetEntityModel(object) == GetHashKey("prop_acc_guitar_01") then
ReqAndDelete(object, true)
end
end
for i=1,#CageObjs do
if GetEntityModel(object) == GetHashKey(CageObjs[i]) then
ReqAndDelete(object, false)
end
end
finished, object = FindNextObject(handle)
until not finished
EndFindObject(handle)
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsPedJumping(PlayerPedId()) then
local jumplength = 0
repeat
Wait(0)
jumplength=jumplength+1
local isStillJumping = IsPedJumping(PlayerPedId())
until not isStillJumping
if jumplength > 250 then
TriggerServerEvent("AntiCheese:JumpFlag", jumplength )
end
end
end
end)