JohnnyS / JD_logsV3

JD Logs V3 by Prefech/JokeDevil. I was a admin on the discord, not sure what happened to him. This is no longer being maintained.
35 stars 26 forks source link

Getting error on @JD_logsV3/server/main.lua:295: #3

Closed galibmahin closed 1 year ago

galibmahin commented 1 year ago

image

mikwbm commented 1 year ago

same

JohnnyS commented 1 year ago

Has to deal with System Messages. It uses the API and that is gone, does it stop it from working?

CreateThread(function() --[[ System Messages. ]]
    while true do
        PerformHttpRequest('https://api.prefech.dev/v1/fivem/jdlogs/systemMsg', function(code, res, headers)
            if code == 200 then
                local rv = json.decode(res)
                if rv.item.id then
                    if os.time(os.date("!*t")) - tonumber(rv.item.date) < (7 * 24 * 60 * 60) then
                        if GetResourceKvpString('JD_logs:SystemMessage') ~= rv.item.message then
                            print('^1JD_logs System Message\n^1--------------------^0\n^2'..rv.item.title..'^0\n'..rv.item.message..'\n^1--------------------^0')
                            ServerFunc.CreateLog({ EmbedMessage = '**'..rv.item.title..'**\n'..rv.item.message, channel = 'system'})
                        end
                    end
                    SetResourceKvp("JD_logs:SystemMessageId", ''..rv.item.id..'')
                    SetResourceKvp("JD_logs:SystemMessage", ''..rv.item.message..'')
                end
            end
        end, 'GET', nil, {
            ['Token'] = 'JD_logsV3',
            ['Last'] = GetResourceKvpString('JD_logs:SystemMessageId')
        })
        Wait(15 * 60 * 1000)
    end
end)
afonsoparoco commented 1 year ago

YES

JohnnyS commented 1 year ago

Comment it out and test, it should not affect anything

Arthurieto77 commented 1 year ago

I have the same error how can i fix it?

JohnnyS commented 1 year ago

Read above, comment out those lines and test and report back if it still works

tonyydung126 commented 1 year ago

I have same error, can any one fix that ? image

tonyydung126 commented 1 year ago

Read above, comment out those lines and test and report back if it still works

Hi, in server main.lua already have all that comment but it not fix. it still show many SCRIPT ERROR. Many thanks

YungT-SevsideRP commented 1 year ago

so if i would comment this function out would the logs and everything still work?

JohnnyS commented 1 year ago

It looks like it causes errors but idk if it still works or not. I'll try to see if I can find a work around when I can work on it.

YungT-SevsideRP commented 1 year ago

alr thanks

YungT-SevsideRP commented 1 year ago

I know this might be off-topic but what happened to Prefech/JokeDevil all of a sudden they disappeared

Exyztence commented 1 year ago

Same error, any working fix for that?

JohnnyS commented 1 year ago

I know this might be off-topic but what happened to Prefech/JokeDevil all of a sudden they disappeared

Not sure tbh, we have no information

Cyzxin commented 1 year ago

Same error, any working fix for that?

The error isnt script breaking so don't worry for now, ill make a PR soon and it will hopefully be fixed

Sina30 commented 1 year ago

We did it that way and now we no longer get the error message and it is now working for us

CreateThread(function() --[[ System Messages. ]]
    while true do
        PerformHttpRequest('https://api.prefech.dev/v1/fivem/jdlogs/systemMsg', function(code, res, headers)
            if code == 200 then
                local rv = json.decode(res)
                if rv and rv.item and rv.item.id then
                    if os.time(os.date("!*t")) - tonumber(rv.item.date) < (7 * 24 * 60 * 60) then
                        if GetResourceKvpString('JD_logs:SystemMessage') ~= rv.item.message then
                            print('^1JD_logs System Message\n^1--------------------^0\n^2'..rv.item.title..'^0\n'..rv.item.message..'\n^1--------------------^0')
                            ServerFunc.CreateLog({ EmbedMessage = '**'..rv.item.title..'**\n'..rv.item.message, channel = 'system'})
                        end
                    end
                    SetResourceKvp("JD_logs:SystemMessageId", tostring(rv.item.id))
                    SetResourceKvp("JD_logs:SystemMessage", tostring(rv.item.message))
                end
            end
        end, 'GET', nil, {
            ['Token'] = 'JD_logsV3',
            ['Last'] = GetResourceKvpString('JD_logs:SystemMessageId')
        })
        Wait(15 * 60 * 1000)
    end
end)
Exyztence commented 1 year ago

We did it that way and now we no longer get the error message and it is now working for us

CreateThread(function() --[[ System Messages. ]]
    while true do
        PerformHttpRequest('https://api.prefech.dev/v1/fivem/jdlogs/systemMsg', function(code, res, headers)
            if code == 200 then
                local rv = json.decode(res)
                if rv and rv.item and rv.item.id then
                    if os.time(os.date("!*t")) - tonumber(rv.item.date) < (7 * 24 * 60 * 60) then
                        if GetResourceKvpString('JD_logs:SystemMessage') ~= rv.item.message then
                            print('^1JD_logs System Message\n^1--------------------^0\n^2'..rv.item.title..'^0\n'..rv.item.message..'\n^1--------------------^0')
                            ServerFunc.CreateLog({ EmbedMessage = '**'..rv.item.title..'**\n'..rv.item.message, channel = 'system'})
                        end
                    end
                    SetResourceKvp("JD_logs:SystemMessageId", tostring(rv.item.id))
                    SetResourceKvp("JD_logs:SystemMessage", tostring(rv.item.message))
                end
            end
        end, 'GET', nil, {
            ['Token'] = 'JD_logsV3',
            ['Last'] = GetResourceKvpString('JD_logs:SystemMessageId')
        })
        Wait(15 * 60 * 1000)
    end
end)

Thanks! Btw, do you have any fix for that?

[ script:JD_logsV3] SCRIPT ERROR: @JD_logsV3/server/main.lua:216: bad argument #2 to 'gsub' (string/function/table expected, got nil)

I tried something like that, will it work? if nil then return end

Cyzxin commented 1 year ago

[ script:JD_logsV3] SCRIPT ERROR: @JD_logsV3/server/main.lua:216: bad argument #2 to 'gsub' (string/function/table expected, got nil)

you are missing a weapon name from clientTables.lua