samp.directory
← Skrypty i biblioteki

wweziza/SAM-dialog

SA-MP dialogs design for FiveM

Narzędzie★ 1zaktualizowano lip 2024Brak licencjiLua
Otwórz na GitHubie

To repozytorium nie ma pliku licencji. Jest publiczne do odczytu, ale samo to nie daje pozwolenia na ponowne użycie.

README.md

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

-- yourResource/client/main.lua

RegisterCommand("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

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

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.

esxfivemgtasagtavqbcoreqbcore-frameworksa-mpsamp

Ta strona jest zbudowana z tego, co GitHub publikuje o repozytorium. samp.directory nie hostuje kodu. Zgłoś problem z tym wpisem

wweziza/SAM-dialog: Narzędzie SA-MP | samp.directory