mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-11-21 19:38:33 +00:00
Add event to clear AuthEvent for player
When a player logs out and back in (switches character) it was thinking that the `AuthEvent` was being called more than once, triggering a warning message This should clear the event when a player unloads and then allows them to request a new one
This commit is contained in:
1 parent
1f4a2ee3d9
commit
a203657e2a
1 file changed
+13
-1
+13
-1
@@ -742,7 +742,8 @@ if isServer() then
|
||||
return ""
|
||||
end
|
||||
debugPrint("^1Auth^7: ^2Player Source^7: "..src.." ^2requested ^3AuthEvent^7", AuthEvent)
|
||||
if not receivedEvent[src] then receivedEvent[src] = true
|
||||
if not receivedEvent[src] then
|
||||
receivedEvent[src] = true
|
||||
return AuthEvent
|
||||
else
|
||||
print("^1Auth^7: ^1Player ^7"..src.." ^1tried to request auth token more than once^7")
|
||||
@@ -750,6 +751,12 @@ if isServer() then
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent(getScript()..":clearAuthEventRequest", function()
|
||||
local src = source
|
||||
debugPrint("^1Auth^7: ^2Manually clearing Auth Event for Player Source^7:", src, AuthEvent)
|
||||
receivedEvent[src] = nil
|
||||
end)
|
||||
|
||||
-- Multiuse function to check if the generated client token is valid
|
||||
function checkToken(src, token, genType, name)
|
||||
if token == nil then
|
||||
@@ -782,5 +789,10 @@ else
|
||||
debugPrint("^1Auth^7: ^2Requesting ^3Auth Event^7")
|
||||
AuthEvent = triggerCallback(getScript()..":callback:GetAuthEvent")
|
||||
end, true)
|
||||
|
||||
onPlayerUnload(function()
|
||||
debugPrint("^1Auth^7: ^2Clearing Auth Event^7")
|
||||
TriggerServerEvent(getScript()..":clearAuthEventRequest")
|
||||
end, true)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user