/survey command: collect player feedback with an ox_lib dialog
By the end of this lesson you type /survey in chat, fill in a three-question form that ox_lib draws for you, hit submit, and watch the validated answers print in the server console, not the client. You write zero HTML, JS, or CSS for the form.
Build it
Make the resource folder
Inside your server's resources folder, create this folder:
resources/qu_survey
Create the files
Create this exact file layout:
resources/qu_survey/
fxmanifest.lua
client.lua
server.lua
Write fxmanifest.lua
Open fxmanifest.lua and paste this:
fx_version 'cerulean'
game 'gta5'
shared_script '@ox_lib/init.lua'
client_script 'client.lua'
server_script 'server.lua'
dependencies {
'ox_lib'
}
fx_version 'cerulean' is the current manifest format, so always use it. game 'gta5' says this resource targets GTA V. There is no lua54 'yes' line: that directive was removed in June 2025, Lua 5.4 is now the only runtime, so the line does nothing and you should not add it. The shared_script '@ox_lib/init.lua' line loads ox_lib's lib global into your resource, and dependencies { 'ox_lib' } blocks startup until ox_lib is running.
Write the client form
Open client.lua and paste this:
RegisterCommand('survey', function()
local answers = lib.inputDialog('Player Feedback Survey', {
{ type = 'input', label = 'What is your favorite in-game activity?', required = true, max = 100 },
{ type = 'number', label = 'Rate the server performance (1-10)', required = true, min = 1, max = 10 },
{ type = 'checkbox', label = 'Would you recommend this server?' },
})
if not answers then
print('[qu_survey] survey cancelled')
return
end
TriggerServerEvent('qu_survey:submit', {
activity = answers[1],
rating = answers[2],
recommend = answers[3],
})
end, false)
Write the server validator
Open server.lua and paste this:
RegisterNetEvent('qu_survey:submit', function(data)
local src = source
if type(data) ~= 'table' then return end
local activity = data.activity
local rating = data.rating
local recommend = data.recommend
if type(activity) ~= 'string' or #activity == 0 or #activity > 100 then
print('[qu_survey] rejected ' .. GetPlayerName(src) .. ': bad activity')
return
end
rating = tonumber(rating)
if not rating or rating < 1 or rating > 10 then
print('[qu_survey] rejected ' .. GetPlayerName(src) .. ': rating out of range')
return
end
local recommendText = (recommend == true) and 'Yes' or 'No'
print('[qu_survey] ' .. GetPlayerName(src) .. ' | activity: ' .. activity
.. ' | rating: ' .. rating .. ' | recommend: ' .. recommendText)
end)
Start and test it
Make sure ox_lib starts first. Open server.cfg and add both lines in this order:
ensure ox_lib
ensure qu_survey
Save, then run this in the txAdmin Live Console (the server console):
restart qu_survey
Join the server, then run this from the in-game chat box (press T) (this is a client command):
/survey
Type Racing for the activity, 8 for the rating, tick the recommend box, and submit.
The line appears in the server console, not F8, because the answers travelled up to server.lua to be validated before anything was logged.
Keep reading the full lesson
Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.
- How it works
- If something went wrong
- What you can do now
- Try it yourself
The remainder of Player survey form with ox_lib is available to FiveM School members.