https://github.com/wweziza/sam-dialog
SA-MP dialogs design for FiveM
https://github.com/wweziza/sam-dialog
esx fivem gtasa gtav qbcore qbcore-framework sa-mp samp
Last synced: 4 months ago
JSON representation
SA-MP dialogs design for FiveM
- Host: GitHub
- URL: https://github.com/wweziza/sam-dialog
- Owner: wweziza
- Created: 2024-07-21T05:25:25.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-22T04:26:32.000Z (about 1 year ago)
- Last Synced: 2025-05-28T00:09:52.022Z (5 months ago)
- Topics: esx, fivem, gtasa, gtav, qbcore, qbcore-framework, sa-mp, samp
- Language: Lua
- Homepage:
- Size: 157 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SAM Dialog
Is sa-mp dialog design-look-a-like for FiveM, the function and usage are same like the sa-mp docs, yet another utility if you do miss a masterpiece memories### Screenshot
Screenshot 1
Screenshot 2
Screenshot 3
# Usage
The usage is pretty simple just put it on your `resources` files and `ensure SAM-dialog` in server.cfg, you can use both in server or client side OR you can use it on your own resource.Example
```lua
-- yourResource/client/main.luaRegisterCommand("serverdialog", function(source, args, rawCommand)
local playerId = GetPlayerServerId(PlayerId())
local dialogid = 5
local style = 1 -- DIALOG_STYLE_INPUT
local title = "Server Dialog"
local body = "This dialog was triggered from the server. Enter some text:"
local button1 = "Submit"
local button2 = "Close"
TriggerEvent("SAM-dialog:Client:ShowPlayerDialog", playerId, dialogid, style, title, body, button1, button2)false)
```## Callback
Every functions trigger server event called and you also can listen it to another resources (just make sure it ensured first before your resources)
Just add this to your resources
```lua
RegisterNetEvent('SAM-scoreboard:Server:Custom:OnDialogResponse')
AddEventHandler('SAM-scoreboard:Server:Custom:OnDialogResponse', function(dialogid, response, listitem, inputtext)
-- Handle the event here
print("Received player click event in Example resource. Dialog ID: " .. dialogid .. ", Response: " .. response .. ", Listitem: " .. listitem ... ", Inputtext: " ... inputtext)
end)
```## DIALOG_STYLE:style
```lua
Style 0: DIALOG_STYLE_MSGBOX
Style 1: DIALOG_STYLE_INPUT
Style 2: DIALOG_STYLE_LIST
Style 3: DIALOG_STYLE_PASSWORD
Style 4: DIALOG_STYLE_TABLIST
Style 5: DIALOG_STYLE_TABLIST_HEADERS
```It's still work in progress so it only support style 0-2.
Feel free to open an issue, and contribute are welcomed.
### Note
The original event will be called first than the custom event.