RegisterNetEvent('esx_society:openBossMenu')
AddEventHandler('esx_society:openBossMenu', function(token)
local _source = source
if not exports['salty_tokenizer']:secureServerEvent(GetCurrentResourceName(), _source, token) then
return false
end
print("Authenticated")
end)
Like this idea, got to play abit around with this to see how it works.
Just to be sure i understand this 100% - if i got a resource called letâs say âbobcatâ and this script got some client scripting but calls a server side function in a resource called ârentâ would that still work?
Not exactly, because by default both resources would get two different security tokens. No, there is a few ways to get around this:
âProxyâ the requests. So, make a server event on âbobcatâ that you can trigger, that will then trigger a server event in the ârentâ resource from the server-side. This is what I do.
Take a look at init.lua. You can replace GetCurrentResourceName() with the actual resource name. So, from within âbobcatâ you could add the following snippet to get the rent token:
Unrelated to the tokenizer(sorry, gramps!) but regarding the discussion of protecting client scripts, I was thinking about this last week. I imagine it would be possible to modify or create scripts that would keep skeleton functions on the client side but that would require server to pass the meat and potatoes of the functions over on connection, wouldnât it? In my mind, I imagine something that required an initial var to be passed, one that contained the contents of that function to be passed over which would then be used. Without those vars, I picture the client scripts providing even a more incomplete picture of the script than just missing the server side.
Would that be something possible without huge performance losses?