- 23
- 1
- Версия MoonLoader
- .026-beta
Привет, у меня скрипт, отправляющий урон всем игрокам, выдал ошибку, когда я набираю команду, он не наносит урон всем игрокам в зоне стрима, что не так?
moonloader.log:
[20:15:39.222252] (system) Session started.
[20:15:39.223264] (debug) Module handle: 60B80000
MoonLoader v.026.5-beta loaded.
Developers: FYP, hnnssy, EvgeN 1137
Copyright (c) 2016, BlastHack Team
https://www.blast.hk/moonloader/
[20:15:39.223264] (info) Working directory: C:\sa\moonloader
[20:15:39.223264] (debug) FP Control: 0009001F
[20:15:39.223264] (debug) Game: GTA SA 1.0.0.0 US
[20:15:39.223264] (system) Installing pre-game hooks...
[20:15:39.225256] (system) Hooks installed.
[20:15:40.568892] (debug) Initializing opcode handler table
[20:15:40.568892] (debug) package.path = C:\sa\moonloader\lib\?.lua;C:\sa\moonloader\lib\?\init.lua;C:\sa\moonloader\?.lua;C:\sa\moonloader\?\init.lua;.\?.lua;C:\sa\moonloader\lib\?.luac;C:\sa\moonloader\lib\?\init.luac;C:\sa\moonloader\?.luac;C:\sa\moonloader\?\init.luac;.\?.luac
[20:15:40.568892] (debug) package.cpath = C:\sa\moonloader\lib\?.dll;
[20:15:40.570892] (system) Loading script 'C:\sa\moonloader\NoFuckingAntiC.lua'...
[20:15:40.570892] (debug) New script: 0ED84EA4
[20:15:40.574892] (system) NoFuckingAntiC.lua: Loaded successfully.
[20:15:40.574892] (system) Loading script 'C:\sa\moonloader\SERVERLOG.lua'...
[20:15:40.574892] (debug) New script: 0ED857D4
[20:15:40.579893] (system) SERVERLOG.lua: Loaded successfully.
[20:15:40.579893] (system) Loading script 'C:\sa\moonloader\skip.luac'...
[20:15:40.579893] (debug) New script: 0ED85AE4
[20:15:40.582896] (system) skip.luac: Loaded successfully.
[20:15:40.582896] (system) Loading script 'C:\sa\moonloader\test.lua'...
[20:15:40.582896] (debug) New script: 0FA7F3DC
[20:15:40.586896] (system) test.lua: Loaded successfully.
[20:15:40.586896] (system) Loading script 'C:\sa\moonloader\weaponghost.luac'...
[20:15:40.586896] (debug) New script: 0FA80AD4
[20:15:40.589897] (system) weaponghost.luac: Loaded successfully.
[20:15:44.898165] (system) Installing post-load hooks...
[20:15:44.898165] (system) Hooks installed.
[20:17:20.566785] (error) test.lua: C:\sa\moonloader\test.lua:20: attempt to perform arithmetic on global 'cx' (a nil value)
stack traceback:
C:\sa\moonloader\test.lua: in function 'seekTarget'
C:\sa\moonloader\test.lua:32: in function <C:\sa\moonloader\test.lua:31>
stack traceback:
[C]: in function 'create'
C:\sa\moonloader\test.lua:31: in function <C:\sa\moonloader\test.lua:30>
[20:17:20.566785] (error) test.lua: Script died due to an error. (0FA7F3DC)
[20:18:02.945422] (system) Unloading...
[20:18:02.945422] (system) NoFuckingAntiC.lua: Script terminated. (0ED84EA4)
[20:18:02.946422] (system) SERVERLOG.lua: Script terminated. (0ED857D4)
[20:18:02.946422] (system) skip.luac: Script terminated. (0ED85AE4)
[20:18:02.947417] (system) weaponghost.luac: Script terminated. (0FA80AD4)
test.lua:
local events = require 'lib.samp.events'
damage = 0
damag = 300
function main()
repeat wait(0) until isSampAvailable()
msg("Welcome")
sampRegisterChatCommand("kkkkkk", admg)
wait(-1)
end
function seekTarget()
local ax, ay, az = getCharCoordinates(1)
local minDist = 9999
local closestPed, closestId = -1, -1
for k, v in pairs(getAllChars()) do
local bx, by, bz = getCharCoordinates(v)
local sx, sy = convert3DCoordsToScreen(bx, by, bz)
local dist = math.sqrt( (sx - cx) ^ 2 + (sy - cy) ^ 2 )
if not isCharDead(v) and v ~= 1 and dist < minDist and isLineOfSightClear(ax, ay, az, bx, by, bz, true, true, false, true, true) then
minDist = dist
closestPed = v
closestId = select(2, sampGetPlayerIdByCharHandle(v))
end
end
return closestPed, closestId
end
function admg()
lua_thread.create(function()
dead = seekTarget()
if sampIsPlayerConnected(dead) then
for i = 0, 350 do
damage = damage + 300
math.randomseed(os.time()); dw = math.random(3,9)
sampSendGiveDamage(dead, damag, 0, dw)
wait(0)
end
damage = 0
else
msg("Error")
end
end)
end
function msg(text)
return sampAddChatMessage(text, -1)
end