So i’m trying to make like an NUI page that pops up when someone types in /getid (their ingame id)
and i want it to display like an NUI page that they can close i’ve tried following this but i am really confused on how it works.
i really am not sure how to do this correctly i’ve only made basic scripts like when they type in their id it shows them their identifiers but not like html any help would be great!
my id code:
function ExtractIdentifiers()
local identifiers = {
steam = "",
ip = "",
discord = "",
license = "",
xbl = "",
live = ""
}
--Loop over all identifiers
for i = 0, GetNumPlayerIdentifiers(source) - 1 do -- grabs the identifier
local id = GetPlayerIdentifier(source, i)
--Convert it to a nice table.
if string.find(id, "steam") then
identifiers.steam = id -- grab their steamid
elseif string.find(id, "ip") then
identifiers.ip = id -- grab their ip
elseif string.find(id, "discord") then
identifiers.discord = id -- grab the discord ID
elseif string.find(id, "license") then
identifiers.license = id -- grab their rockstar game license
elseif string.find(id, "xbl") then
identifiers.xbl = id -- grab the XBL ID
elseif string.find(id, "live") then
identifiers.live = id -- grab their Live ID
end
end
return identifiers
end
-- Usage:
RegisterCommand("getids", function(source, args, rawCommand) -- register the command
if #args < 1 then -- if the user types only /getids no arguments then return a function
return TriggerClientEvent('chatMessage', source, "^1System", "Invalid Server ID") -- if no args then return a chat message
end -- end the function
TriggerEvent("rhys19:request_id") -- trigger the event
end) -- end the RegisterCommand Function
RegisterServerEvent("rhys19:request_id") -- Register the server event
AddEventHandler("rhys19:request_id", function(source) -- add the event handler
local identifiers = ExtractIdentifiers() --
local steam = identifiers.steam --
TriggerClientEvent('chatMessage', source, "^1System", "Your identifiers are: "..ExtractIdentifiers()) -- send a chat message.
print("Saved Steam Identifier to data/identifiers.json") -- print to console.
EnableGui(enable) -- Enable the NUI
end)
function EnableGui(enable)
SendNUIMessage({
type = "enableui",
enable = enable
})
end
thanks to @Syntasu for the identifier example
any idea how i could do this?
i know i would need an html part but i’m not sure what i would start with in it.