Skip to content

Commit ab7080c

Browse files
authored
Fix example code
1 parent a13a852 commit ab7080c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ Native functions that expect a parameter of type `Any *` as an argument can take
6868
local t = {}
6969
local ffi = require'ffi'
7070

71+
function t.OnLoad()
72+
t.me = PLAYER:PLAYER_ID()
73+
t.me_ent = PLAYER:GET_PLAYER_PED(t.me)
74+
t.ent_arr = native.new('Entity', 1024)
75+
end
76+
7177
function t.OnTick()
7278
if misc.iskeyjustup(VK_F8, true) then
7379
local duration = ffi.new([[
@@ -102,10 +108,11 @@ function t.OnTick()
102108
end
103109
-- If you press F9 it will knock out all peds around you
104110
if mish.iskeyjustup(VK_F9, true) then
105-
local cnt = native.allpeds(mod.ent_arr) - 1
111+
local cnt = native.allpeds(t.ent_arr) - 1
106112
for i = 0, cnt do
107-
if mod.ent_arr[i] ~= mod.me_ent then
108-
TASK:TASK_KNOCKED_OUT(mod.ent_arr[i], 10, false)
113+
if t.ent_arr[i] ~= t.me_ent then
114+
TASK:CLEAR_PED_TASKS(t.ent_arr[i], false, false)
115+
TASK:TASK_KNOCKED_OUT(t.ent_arr[i], 10, false)
109116
end
110117
end
111118
end
@@ -114,7 +121,7 @@ end
114121
return t
115122
```
116123

117-
Here is a list of all the Lua functions provided by the RedLua library:
124+
Here is a list of all the Lua functions provided by RedLua:
118125

119126
```lua
120127
--[[

0 commit comments

Comments
 (0)