Hey. Bit of background, I’m trying to develop a script that can automatically register a vehicle within our CAD system. We’re in need of a character switch system however. I started making this client script based off NativeUI and their MenuExample.lua but I’m not sure if I have done something drastically wrong or it just isn’t executing anything. I have put it in the fxmanifest.lua file (keep in mind that I haven’t used this new system but nothing much really has changed and I added everything mentioned in the docs)
and I’ve cleared my cache several times.
Here is my cl.lua (I have placed various different prints to the console to see where it was going wrong but absolutely none of them printed to the console, in-fact, I don’t get anything but a resource start message)
print("Debug 1")
menuPool = NativeUI.CreatePool()
main = menuPool.CreateMenu("Switch Character", "Test Menu")
menuPool:Add(main)
function AddMenuCharacter(menu, character)
local newitem = NativeUI.CreateItem(character, "Switch your character to " .. character)
menu:AddItem(newitem)
menu.OnItemSelect = function(sender, item, index)
print("Switch request to " .. character)
end
end
AddMenuCharacter(main, "Test Character")
menuPool:RefreshIndex()
Citizen.CreateThread(function()
print("Debug 2")
while true do
Citizen.Wait(0)
menuPool:ProcessMenus()
print("Debug 3")
if IsControlJustPressed(1, 51) then -- 'E' key
print("Debug 4")
main:Visible(not mainMenu:Visible())
end
end
end)
None of this is functional in-game and I’m a bit concerned. My server script I have works totally fine however. I have no idea why. Here is my fxmanifest:
game 'gta5'
fx_version 'cerulean'
server_script '@mysql-async/lib/MySQL.lua'
server_script 'sv.lua'
client_scripts {
"@NativeUI/NativeUI.lua",
"cl.lua"
}
Here is my server.cfg order too if it matters (if you hadn’t gathered, the resource is called registercar):
ensure NativeUI
ensure mysql-async
ensure registercar
If anybody has any ideas, whether it may be me making a really stupid mistake or if this actually just isn’t working, please let me know.
TIA,
James