make a checkToken() event its own function

Several events were calling very similar check token events, so I've just moved them to one to help unify it and help future debugging
This commit is contained in:
Jim Shield
2025-05-05 11:44:51 +01:00
parent c745d51832
commit 4e8a15590f
3 changed files with 39 additions and 37 deletions

View File

@@ -105,14 +105,8 @@ if isServer() then
RegisterNetEvent(getScript()..":server:makeOXStash", function(name, label, slots, weight, owner, coords, token)
local src = source or nil
if src then
debugPrint("^1Auth^7: ^2Auth token received^7, ^2checking against server cache^7..")
if token == nil then
debugPrint("^1Auth^7: ^1Token not received^7")
elseif token ~= validTokens[src] then
debugPrint("^1Auth^7: ^1Tokens don't match! ^7", token, validTokens[src])
else
debugPrint("^1Auth^7: ^2Client and Server Auth tokens match^7!", token, validTokens[src])
validTokens[src] = nil
if not checkToken(src, token, "stash", name) then
return
end
end