Développement Lua
Créer son premier script FiveM avec interface NUI
Publié le 24/08/2026
29 lectures
Apprenez à lier le Lua client/server avec une interface HTML/CSS moderne via SendNUIMessage et NuiCallback.
1. STRUCTURE DU DOSSIER
mon_script/
├── fxmanifest.lua
├── client/main.lua
├── server/main.lua
└── html/
├── index.html
├── style.css
└── script.js
2. FXMANIFEST.LUA
fx_version 'cerulean'
game 'gta5'
ui_page 'html/index.html'
files {
'html/index.html',
'html/style.css',
'html/script.js'
}
client_scripts { 'client/main.lua' }
3. OUVRIR L'INTERFACE (CLIENT.LUA)
RegisterCommand('menu', function()
SetNuiFocus(true, true)
SendNUIMessage({ action = 'open' })
end)
4. FERMETURE VIA JAVASCRIPT (SCRIPT.JS)
document.onkeyup = function(data) {
if (data.key === "Escape") {
fetch(`https://${GetParentResourceName()}/close`, { method: 'POST' });
}
};