Вопрос по луа

PhantomLate

Известный
Автор темы
8
2
Версия MoonLoader
.026-beta
При заходе в игру скрипт реагирует как твой персонаж умирает.
Как сделать так, что бы скрипт не записывал смерть айди 65535?
 

PhantomLate

Известный
Автор темы
8
2
Lua:
function sampev.onPlayerDeathNotification(killerId, killedId, reason)
    if killerId ~= 65535 then
        sampAddChatMessage('ты сдох')
    end
    if killedId ~= 65535 then
        sampAddChatMessage('ты сдох')
    end
    if isPermission and isInitialized then
        local kill = ffi.cast('struct stKillInfo*', sampGetKillInfoPtr())
        local _, myid = sampGetPlayerIdByCharHandle(playerPed)

        local n_killer = ( sampIsPlayerConnected(killerId) or killerId == myid ) and sampGetPlayerNickname(tonumber(killerId)) or nil
        local n_killed = ( sampIsPlayerConnected(killedId) or killedId == myid ) and sampGetPlayerNickname(tonumber(killedId)) or nil

        local k_color = argb2hex(sampGetPlayerColor(killerId))
        local d_color = argb2hex(sampGetPlayerColor(killedId))

        if #killListData > cheats['linesKL'].v then
            for i = 1, #killListData - cheats['linesKL'].v do
                table.remove(killListData, i)
            end
        end

        if imgTextures['reasonKills'][tonumber(reason)] == nil then
            sampAddChatMessage('{F6361C}[Ошибка]{FFFFFF} Обнаружена неизвестная причина погибели: ' .. reason,-1)
        end
        lua_thread.create(function()
            wait(0)

            if not isGamePaused() then
                
                if window == 0 and d_color == k_color and warningsSettings['teamKill']['state'].v and sampGetPlayerColor(killerId) ~= 23486046 and sampGetPlayerColor(killerId) ~= 2164260863 and sampGetPlayerColor(killerId) ~= 368966908 and sampGetPlayerColor(killerId) ~= 4294967295 and sampGetPlayerColor(killerId) ~= 16777215 and os.time() - playerAfkLastTime > 5 then
                    sampAddChatMessage("{F6361C}[Warning | TK] {" .. k_color .. "}" .. n_killer .."[" .. killerId .."] {D74F4F}убил своего напарника по фракции {" .. d_color .. "}" .. n_killed .."[" .. killedId .. "]", -1)
                end

                if warningsSettings['massDM']['state'].v then

                    massDmInfo[#massDmInfo + 1] = {
                        n_killer,
                        killerId,
                        os.time(),
                    }

                    local count_finded = 0
                    local first_finded = nil
                    for k,v in pairs(massDmInfo) do
                        if n_killer == v[1] then
                            if not first_finded then
                                first_finded = os.time() - v[3]
                            end
                            count_finded = count_finded + 1
                        end
                    end

                    if count_finded >= warningsSettings['massDM']['count'].v and first_finded and os.time() - playerAfkLastTime > 5 then
                        --sampAddChatMessage(n_killer) " .. n_killer  .. "
                        --sampAddChatMessage('1')
                        sampAddChatMessage("{F6361C}[Warning | DM]{" .. k_color .. "} [" .. killerId .. "]{FFFFFF} совершил {DE503A}" .. count_finded .. "{FFFFFF} убийств за " .. first_finded  .. " секунд из " .. warningsSettings['massDM']['seconds'].v .. " разрешенных!", -1)
                    end
                    
                end
            end

            killListData[#killListData + 1] = {
                ['time'] = os.time(),
                ['KNick'] = n_killer,
                ['VNick'] = n_killed,
                ['KID'] = killerId,
                ['VID'] = killedId,
                ['KColor'] = argb2hex(kill.killEntry[4].clKillerColor),
                ['VColor'] = argb2hex(kill.killEntry[4].clVictimColor),
                ['Reason'] = reason
            }

        end)
    end
end