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

@@ -441,17 +441,8 @@ RegisterNetEvent(getScript()..":Crafting:GetItem", function(ItemMake, craftable,
return
end
if token == nil then
debugPrint("^1Auth^7: ^1No token recieved^7")
dupeWarn(src, item, "Auth: Player "..src.." attempted to spawn "..item.." without an auth token")
else
if token ~= validTokens[src] then
debugPrint("^1Auth^7: ^1Tokens don't match! ^7", token, validTokens[src])
dupeWarn(src, item, "Auth: "..src.." attempted to trigger server only events with an incorrect auth token")
else
debugPrint("^1Auth^7: ^2Client and Server Auth tokens match^7!", token, validTokens[src])
validTokens[src] = nil
end
if not checkToken(src, token, "item", ItemMake) then
return
end