Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
galibmahin opened this issue Mar 29, 2023 · 18 comments
Closed

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

galibmahin opened this issue Mar 29, 2023 · 18 comments

Comments

@galibmahin
Copy link

image

@mikwbm
Copy link

mikwbm commented Mar 30, 2023

same

@JohnnyS
Copy link
Owner

JohnnyS commented Mar 31, 2023

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
Copy link

YES

@JohnnyS
Copy link
Owner

JohnnyS commented Apr 11, 2023

Comment it out and test, it should not affect anything

@Arthurieto77
Copy link

I have the same error how can i fix it?

@JohnnyS
Copy link
Owner

JohnnyS commented Apr 17, 2023

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

@tonyydung126
Copy link

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

@tonyydung126
Copy link

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
Copy link

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

@JohnnyS
Copy link
Owner

JohnnyS commented May 5, 2023

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
Copy link

alr thanks

@YungT-SevsideRP
Copy link

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

@Exyztence
Copy link

Same error, any working fix for that?

@JohnnyS
Copy link
Owner

JohnnyS commented May 8, 2023

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
Copy link
Collaborator

Cyzxin commented May 16, 2023

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
Copy link

Sina30 commented Jun 6, 2023

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
Copy link

Exyztence commented Jun 8, 2023

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
Copy link
Collaborator

Cyzxin commented Jun 8, 2023

[ 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants