-
Notifications
You must be signed in to change notification settings - Fork 17
/
cl_pedscache.lua
55 lines (42 loc) · 1.31 KB
/
cl_pedscache.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
g_peds = {}
g_zombieAmount = 0
local function FetchPeds()
local zombieAmount = 0
local untilPause = 10
for ped, pedData in pairs(g_peds) do
if not DoesEntityExist(ped) or IsPedDeadOrDying(ped) then
g_peds[ped] = nil
elseif pedData.IsZombie then
zombieAmount = zombieAmount + 1
end
end
for ped in EntityEnum.EnumeratePeds() do
local relationshipGroup = GetPedRelationshipGroupHash(ped)
local isZombie = relationshipGroup == ZOMBIE_GROUP
local isGuard = relationshipGroup == SAFEZONE_GUARD_GROUP
local combatTarget
if isZombie then
zombieAmount = zombieAmount + 1
for ped2 in EntityEnum.EnumeratePeds() do
if IsPedInCombat(ped, ped2) then
combatTarget = ped2
break
end
end
end
g_peds[ped] = {IsZombie = isZombie, RelationshipGroup = relationshipGroup, ZombieCombatTarget = combatTarget,
IsGuard = isGuard}
untilPause = untilPause - 1
if untilPause < 0 then
untilPause = 10
Wait(0)
end
end
g_zombieAmount = zombieAmount
end
Utils.CreateLoadedInThread(function()
while true do
Wait(100)
FetchPeds()
end
end)