Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-11-16, 19:18


ADISEQ

Uczeń Lua






Wiek: 21
Na forum: 2952 dni
Posty: 130
Nick w MP: ADISEQ

Piwa: 18

Respekt: 50

Siema. Zrobi?em skrypt na gui po wejsciu w marker. Gdy go odpalam w db3 wyskakuje:

Kod:

ERROR: Loading script failed: yd-komisy\c.lua:53: unexpected symbol near "if"


Kod skryptu jest taki:
local zamawianie=createMarker(-1654.47, 1318.40, 6.3, "cylinder", 1, 51,102,255)


button1 = guiCreateButton(0.26, 0.71, 0.13, 0.06, "Zam?w", true)


button2 = guiCreateButton(0.61, 0.71, 0.13, 0.06, "Zamknij", true)


lista = guiCreateGridList(0.26, 0.29, 0.48, 0.38, true)
guiGridListAddColumn(lista, "Model", 0.2)
guiGridListAddColumn(lista, "Cena", 0.2)
guiGridListAddColumn(lista, "Przebieg", 0.2)
guiGridListAddColumn(lista, "Pojemno??", 0.2)
for i = 1, 4 do
    guiGridListAddRow(lista)
end
guiGridListSetItemText(lista, 0, 1, "BMW M2", false, false)
guiGridListSetItemText(lista, 0, 2, "cena1", false, false)
guiGridListSetItemText(lista, 0, 3, "0", false, false)
guiGridListSetItemText(lista, 0, 4, "2.0 dm3", false, false)
guiGridListSetItemText(lista, 1, 1, "Ford Mustang GT", false, false)
guiGridListSetItemText(lista, 1, 2, "cena2", false, false)
guiGridListSetItemText(lista, 1, 3, "0", false, false)
guiGridListSetItemText(lista, 1, 4, "2.0 dm3", false, false)
guiGridListSetItemText(lista, 2, 1, "-", false, false)
guiGridListSetItemText(lista, 2, 2, "-", false, false)
guiGridListSetItemText(lista, 2, 3, "-", false, false)
guiGridListSetItemText(lista, 2, 4, "-", false, false)
guiGridListSetItemText(lista, 3, 1, "-", false, false)
guiGridListSetItemText(lista, 3, 2, "-", false, false)
guiGridListSetItemText(lista, 3, 3, "-", false, false)
guiGridListSetItemText(lista, 3, 4, "-", false, false)

local bold= dxCreateFont(":Fonts/f.ttf", 30)
local screenW, screenH = guiGetScreenSize()

function zamawianko()
    dxDrawRectangle(screenW * 0.2427, screenH * 0.2167, screenW * 0.5146, screenH * 0.5667, tocolor(35, 35, 35, 200), false)
    exports['yd-gui_system']:customButton('Zam?w', screenW * 0.26, screenH * 0.71, screenW * 0.13, screenH * 0.06)   
    exports['yd-gui_system']:customButton('Zamknij okno', screenW * 0.61, screenH * 0.71, screenW * 0.13, screenH * 0.06)  
    dxDrawText("Zamawianie", screenW * 0.4375, screenH * 0.2176, screenW * 0.5620, screenH * 0.2935, tocolor(255, 255, 255, 255), 1.00, bold, "center", "center", false, false, false, false, false)
end

addEventHandler("onClientMarkerHit", marker, function(el,md)
    if el~=localPlayer then return end
    if isPedInVehicle(el) then return end
    if getElementData(el,"player:sid") == 2 or if getElementData(el, "player:sid") == 1 then
    if guiGetVisible(lista) == false then
        showCursor(true)
        guiSetVisible(lista,true)
        addEventHandler("onClientRender", root, zamawianko)
    end
  end
end)


53 linijka:


    if getElementData(el,"player:sid") == 2 or if getElementData(el, "player:sid") == 1 then
Co jest ?le?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-16, 19:26


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

2 razy IF: 1 IF na ca?y 1 warunek.

 if getElementData(el,"player:sid") == 2 or getElementData(el, "player:sid") == 1 then


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
ADISEQ
Wysłany: 2020-11-16, 19:36


ADISEQ

Uczeń Lua






Wiek: 21
Na forum: 2952 dni
Posty: 130
Nick w MP: ADISEQ

Piwa: 18

Respekt: 50

Wilq, Dobra b??du ju? nie ma, ale gui sie wyswietla kazdemu po starcie skryptu

Kod troche zmienilem:

local zamawianie=createMarker(-1654.47, 1318.40, 6.3, "cylinder", 1, 51,102,255)



lista = guiCreateGridList(0.26, 0.29, 0.48, 0.38, true)
guiGridListAddColumn(lista, "Model", 0.2)
guiGridListAddColumn(lista, "Cena", 0.2)
guiGridListAddColumn(lista, "Przebieg", 0.2)
guiGridListAddColumn(lista, "Pojemno??", 0.2)
for i = 1, 4 do
    guiGridListAddRow(lista)
end
guiGridListSetItemText(lista, 0, 1, "BMW M2", false, false)
guiGridListSetItemText(lista, 0, 2, "cena1", false, false)
guiGridListSetItemText(lista, 0, 3, "0", false, false)
guiGridListSetItemText(lista, 0, 4, "2.0 dm3", false, false)
guiGridListSetItemText(lista, 1, 1, "Ford Mustang GT", false, false)
guiGridListSetItemText(lista, 1, 2, "cena2", false, false)
guiGridListSetItemText(lista, 1, 3, "0", false, false)
guiGridListSetItemText(lista, 1, 4, "2.0 dm3", false, false)
guiGridListSetItemText(lista, 2, 1, "-", false, false)
guiGridListSetItemText(lista, 2, 2, "-", false, false)
guiGridListSetItemText(lista, 2, 3, "-", false, false)
guiGridListSetItemText(lista, 2, 4, "-", false, false)
guiGridListSetItemText(lista, 3, 1, "-", false, false)
guiGridListSetItemText(lista, 3, 2, "-", false, false)
guiGridListSetItemText(lista, 3, 3, "-", false, false)
guiGridListSetItemText(lista, 3, 4, "-", false, false)

local bold= dxCreateFont(":Fonts/f.ttf", 30)
local screenW, screenH = guiGetScreenSize()

function zamawianko()
    dxDrawRectangle(screenW * 0.2427, screenH * 0.2167, screenW * 0.5146, screenH * 0.5667, tocolor(35, 35, 35, 200), false)
    exports['yd-gui_system']:customButton('Zam?w', screenW * 0.26, screenH * 0.71, screenW * 0.13, screenH * 0.06)   
    exports['yd-gui_system']:customButton('Zamknij okno', screenW * 0.61, screenH * 0.71, screenW * 0.13, screenH * 0.06)  
    dxDrawText("Zamawianie", screenW * 0.4375, screenH * 0.2176, screenW * 0.5620, screenH * 0.2935, tocolor(255, 255, 255, 255), 1.00, bold, "center", "center", false, false, false, false, false)
end

addEventHandler("onClientMarkerHit", zamawianie, function(el,md)
    if el~=localPlayer then return end
    if isPedInVehicle(el) then return end
    if getElementData(el,"player:sid") == 2 or getElementData(el, "player:sid") == 1 then
    if guiGetVisible(lista) == false then
        showCursor(true)
        guiSetVisible(lista,true)
        addEventHandler("onClientRender", root, zamawianko)
    end
  end
  end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-16, 19:58


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8


Więcej informacji znajdziesz w Wikipedii MTA:

guiSetVisible


Ustaw te GUI widoczno?? na false.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
ADISEQ
Tagi: gui
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku