Zmajk0

Untitled

Jan 1st, 2021
1,249
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. RegisterNetEvent("wtf_characters:getSteamID")
  2. AddEventHandler(
  3.     "wtf_characters:getSteamID",
  4.     function()
  5.         local steamID = nil
  6.         local source = source
  7.         local identifiers = GetPlayerIdentifiers(source)
  8.  
  9.         for _, v in pairs(identifiers) do
  10.             if string.find(v, "steam") then
  11.                 steamID = v
  12.                 break
  13.             end
  14.         end
  15.  
  16.         TriggerClientEvent("wtf_characters:receiveSteamID", source, steamID)
  17.     end
  18. )
  19.  
  20. local registeredEvents = {}
  21. RegisterNetEvent("wtf_characters:registerEvent")
  22. AddEventHandler(
  23.     "wtf_characters:registerEvent",
  24.     function(uid, event)
  25.         local source = source
  26.         if registeredEvents[event] == nil then
  27.             registeredEvents[event] = {}
  28.         end
  29.         registeredEvents[event][uid] = source
  30.     end
  31. )
  32.  
  33. RegisterNetEvent("wtf_characters:forwardEvent")
  34. AddEventHandler(
  35.     "wtf_characters:forwardEvent",
  36.     function(uid, event, data)
  37.         local eventUids = registeredEvents[event]
  38.         if eventUids == nil then
  39.             return
  40.         end
  41.         local playerServerId = eventUids[uid]
  42.         if playerServerId ~= nil then
  43.             TriggerClientEvent("wtf_characters:receiveEvent", playerServerId, event, data)
  44.         end
  45.     end
  46. )
RAW Paste Data