Dialog

An input dialog to which you can add input fields

Example

dialog.lua
RegisterCommand('dialog', function()
  local dialog = Dialog:Create('Title', 'Description', 'Submit', 'Cancel');
 
  dialog:AddInput('Text');
  dialog:AddNumberInput('Number', nil, nil, nil, 0);
  dialog:AddPasswordInput('Password');
  dialog:AddColorInput('Color', nil, { 255, 0, 255, 0.5 });
  dialog:AddDateInput('Date');
  dialog:AddCheckbox('Checkbox');
  dialog:AddTextarea('Textarea');
  dialog:AddSelect('Select', nil, nil, {
    {
      label = 'Label',
      value = 'test'
    },
    {
      label = 'Label 2',
      value = 'test2'
    }
  });
 
  print(json.encode(dialog:Open()));
end, false);
fxmanifest.lua
fx_version 'cerulean'
game 'gta5'
lua54 'yes'
 
client_scripts {
  -- this import is needed to use the Dialog variable in your resource
  '@monolith-menu/imports/dialog.lua',
  'dialog.lua'
}