SerweryWłasny serwerDla twórcówForumFAQDokumentacjaBezpieczeństwo
Pobierz launcher
  1. Dokumentacja
  2. Funkcje klienta
  3. guiCreateButton

Funkcja

guiCreateButton

Tworzy przycisk. Kliknięcie wywołuje onClientGUIClick.

Składnia

gui-button guiCreateButton(float x, float y, float width, float height, string text, bool relative [, element parent = nil])

Argumenty

xfloat
Pozycja X.
yfloat
Pozycja Y.
widthfloat
Szerokość.
heightfloat
Wysokość.
textstring
Napis.
relativebool
Wartości względne (0-1) zamiast pikseli.W MTA:SA opcjonalny: bool relative = false
parentelement, opcjonalny = nil
Rodzic, np. okno.

Różnice względem MTA:SA

  • Argumenty zaznaczone innym kolorem różnią się od MTA:SA.

W MTA:SA

guiCreateButton(float x, float y, float width, float height, string text, bool relative = false, gui-element parent = nil)

Zwraca

Przycisk.

Przykład

local btn = guiCreateButton(20, 20, 140, 36, "Napraw auto", false)
addEventHandler("onClientGUIClick", btn, function(button)
    if button == "left" then
        triggerServerEvent("fixMyCar", localPlayer)
    end
end, false)

Uwagi

Trzeci argument false. Dodając obsługę do jednego przycisku, podaj false jako czwarty argument addEventHandler, żeby nie łapać kliknięć dzieci.

Zobacz też