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

Wysłany: 2013-04-28, 21:24


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
To juz ostatnie gui z mojej serii i przestaje was zadreczac :D
Wyswietla blad w debugu w linijce 84 w addEventHandler
CLIENT:
local marker = createMarker(2043, 1543, 10, "cylinder", 2, 0, 255, 0, 30)
local blip = createBlip ( 2043, 1543, 11, 45 )



GUIEditor = {
    gridlist = {},
    button = {},
    edit = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.gridlist[1] = guiCreateGridList(453, 173, 756, 589, false)
        guiSetAlpha(GUIEditor.gridlist[1], 0.86)
        guiSetVisible ( GUIEditor.gridlist[1], false )

        GUIEditor.gridlist[2] = guiCreateGridList(41, 139, 187, 333, false, GUIEditor.gridlist[1])
        guiGridListAddColumn(GUIEditor.gridlist[2], "Pojazd", 0.4)
        guiGridListAddColumn(GUIEditor.gridlist[2], "ID", 0.4)
        for i = 1, 6 do
            guiGridListAddRow(GUIEditor.gridlist[2])
        end
        guiGridListSetItemText(GUIEditor.gridlist[2], 0, 1, "Infernus", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 0, 2, "411", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 1, 1, "Elegy", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 1, 2, "562", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 2, 1, "Bullet", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 2, 2, "541", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 3, 1, "Banshee", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 3, 2, "429", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 4, 1, "Buffalo", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 4, 2, "402", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 5, 1, "NRG-500", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 5, 2, "522", false, false)
        edit = guiCreateEdit(428, 228, 136, 30, "", false, GUIEditor.gridlist[1])
        local kup = guiCreateButton(376, 388, 246, 84, "KUP", false, GUIEditor.gridlist[1])
        local esc = guiCreateButton(27, 527, 60, 44, "X", false, GUIEditor.gridlist[1])
    end
)

    function draw()
        dxDrawText("Salon Samochodowy", 500, 132, 889, 211, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Salon Samochodowy", 500, 130, 889, 209, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Salon Samochodowy", 498, 132, 887, 211, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Salon Samochodowy", 498, 130, 887, 209, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Salon Samochodowy", 499, 131, 888, 210, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawLine(492, 183, 1160, 183, tocolor(255, 255, 255, 255), 1, true)
        dxDrawText("Pojazdy:", 517, 275, 709, 305, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Pojazdy:", 517, 273, 709, 303, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Pojazdy:", 515, 275, 707, 305, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Pojazdy:", 515, 273, 707, 303, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Pojazdy:", 516, 274, 708, 304, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 783, 285, 1030, 324, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 783, 283, 1030, 322, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 781, 285, 1028, 324, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 781, 283, 1028, 322, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 782, 284, 1029, 323, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawLine(776, 339, 1155, 339, tocolor(255, 255, 255, 255), 1, true)
        dxDrawText("Wpisz ID pojazdu", 826, 365, 951, 391, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Cena : 10000$", 831, 482, 1095, 513, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
    end


function otworz ( hitElement )
guiSetVisible( GUIEditor.gridlist[1], true)
showCursor(true)
outputChatBox ( "Witamy w salonie samochodowym!", 255, 0, 0 )
addEventHandler ( "onClientRender", getRootElement(), draw )
end
addEventHandler("onClientMarkerHit", marker, otworz)

function zamknij()
    guiSetVisible ( GUIEditor.gridlist[1], false )
    showCursor ( false )
    guiSetInputEnabled ( false )
    removeEventHandler ( "onClientRender", getRootElement(), draw )
end
addEventHandler("onClientGUIClick", esc, zamknij, false)

function auto()
outputChatBox ( "Kupiles auto.", 255, 0, 0, true)
triggerServerEvent("auto", getRootElement(), player)
end
addEventHandler ( "onClientGUIClick", kup, auto)


SERVER:
function auto ()
    local kasa = getPlayerMoney ( thePlayer )
    local x,y,z = getElementPosition ( thePlayer )
    if kasa >= 10000 then
    createVehicle ( tonumber( guiGetText ( edit ) ), x, y+2, z )
    else
    outputChatBox ( "Nie posiadasz 10000$", thePlayer )
    end
    end
    addEvent("auto", true)
    addEventHandler("auto", getRootElement(), auto)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-28, 21:30


Oski

LUA Scripter






Wiek: 30
Na forum: 5387 dni
Posty: 428
Nick w MP: Oski

Piwa: 56

Respekt: 75,1

Linijka 36,37 zmie? zmienn? localn? na globaln? poprzez usuni?cie "local" z jej przedsrostku.
Powinno pom?c.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-28, 23:15


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Niestety, pokazalo bledy w 78 i 84 linijce z addEventHandler.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 10:44


Oski

LUA Scripter






Wiek: 30
Na forum: 5387 dni
Posty: 428
Nick w MP: Oski

Piwa: 56

Respekt: 75,1


local marker = createMarker(2043, 1543, 10, "cylinder", 2, 0, 255, 0, 30)
local blip = createBlip ( 2043, 1543, 11, 45 )



GUIEditor = {
    gridlist = {},
    button = {},
    edit = {},
    przycisk={}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.gridlist[1] = guiCreateGridList(453, 173, 756, 589, false)
        guiSetAlpha(GUIEditor.gridlist[1], 0.86)
        guiSetVisible ( GUIEditor.gridlist[1], false )

        GUIEditor.gridlist[2] = guiCreateGridList(41, 139, 187, 333, false, GUIEditor.gridlist[1])
        guiGridListAddColumn(GUIEditor.gridlist[2], "Pojazd", 0.4)
        guiGridListAddColumn(GUIEditor.gridlist[2], "ID", 0.4)
        for i = 1, 6 do
            guiGridListAddRow(GUIEditor.gridlist[2])
        end
        guiGridListSetItemText(GUIEditor.gridlist[2], 0, 1, "Infernus", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 0, 2, "411", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 1, 1, "Elegy", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 1, 2, "562", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 2, 1, "Bullet", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 2, 2, "541", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 3, 1, "Banshee", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 3, 2, "429", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 4, 1, "Buffalo", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 4, 2, "402", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 5, 1, "NRG-500", false, false)
        guiGridListSetItemText(GUIEditor.gridlist[2], 5, 2, "522", false, false)
        edit = guiCreateEdit(428, 228, 136, 30, "", false, GUIEditor.gridlist[1])
        przycisk[1] = guiCreateButton(376, 388, 246, 84, "KUP", false, GUIEditor.gridlist[1])
        przycisk[2] = guiCreateButton(27, 527, 60, 44, "X", false, GUIEditor.gridlist[1])
    end
)

    function draw()
        dxDrawText("Salon Samochodowy", 500, 132, 889, 211, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Salon Samochodowy", 500, 130, 889, 209, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Salon Samochodowy", 498, 132, 887, 211, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Salon Samochodowy", 498, 130, 887, 209, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Salon Samochodowy", 499, 131, 888, 210, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawLine(492, 183, 1160, 183, tocolor(255, 255, 255, 255), 1, true)
        dxDrawText("Pojazdy:", 517, 275, 709, 305, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Pojazdy:", 517, 273, 709, 303, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Pojazdy:", 515, 275, 707, 305, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Pojazdy:", 515, 273, 707, 303, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Pojazdy:", 516, 274, 708, 304, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 783, 285, 1030, 324, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 783, 283, 1030, 322, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 781, 285, 1028, 324, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 781, 283, 1028, 322, tocolor(0, 0, 0, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Interakcja:", 782, 284, 1029, 323, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawLine(776, 339, 1155, 339, tocolor(255, 255, 255, 255), 1, true)
        dxDrawText("Wpisz ID pojazdu", 826, 365, 951, 391, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Cena : 10000$", 831, 482, 1095, 513, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false)
    end


function otworz ( hitElement )
guiSetVisible( GUIEditor.gridlist[1], true)
showCursor(true)
outputChatBox ( "Witamy w salonie samochodowym!", 255, 0, 0 )
addEventHandler ( "onClientRender", getRootElement(), draw )
end
addEventHandler("onClientMarkerHit", marker, otworz)

function zamknij()
if source == przycisk[2] then
    guiSetVisible ( GUIEditor.gridlist[1], false )
    showCursor ( false )
    guiSetInputEnabled ( false )
    removeEventHandler ( "onClientRender", getRootElement(), draw )
end
end
addEventHandler("onClientGUIClick", przycisk[2], zamknij)

function auto_f()
if source == przycisk[1] then
outputChatBox ( "Kupiles auto.", 255, 0, 0, true)
triggerServerEvent("auto", getRootElement(), player)
end
end
addEventHandler ( "onClientGUIClick", przycisk[1], auto_f)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 12:22


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Mozesz powiedziec co zmieniles?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 14:10


Oski

LUA Scripter






Wiek: 30
Na forum: 5387 dni
Posty: 428
Nick w MP: Oski

Piwa: 56

Respekt: 75,1

Oczywi?cie, wprowadzi?em zmiany techniczne i wizualne ;]

1. Wcze?niej nazwa funkcji "auto" by?a taka sama jak nazwa eventu
2. Nie doda?e? warunku if source == przycisk then [...] end
3. Przyciski wrzuci?em do tablicy to jest w sumie nie potrzebne ale lepiej si? pracuje na tablicach.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 15:33


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Kod:

3. Przyciski wrzuci?em do tablicy to jest w sumie nie potrzebne ale lepiej si? pracuje na tablicach.p

Jakich tablicach?:)

A tak swoja droga nie wiem gdzie jest blad, w debugu nie pokazuje zadnych, ale i tak przycisku wyjscia nie ma i po wpisaniu id i wcisnieciu Kup, nic sie nie dzieje.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 16:15


Oski

LUA Scripter






Wiek: 30
Na forum: 5387 dni
Posty: 428
Nick w MP: Oski

Piwa: 56

Respekt: 75,1

CLIENT
function auto_f_s (player,edit)
local kasa = getPlayerMoney ( player )
local x,y,z = getElementPosition ( player )
if kasa >= 10000 then
createVehicle ( tonumber( edit ), x, y+2, z )
else
outputChatBox ( "Nie posiadasz 10000$", player )
end
end
addEvent("auto", true)
addEventHandler("auto", getRootElement(), auto_f_s)

SERVER
function auto_f()
if source == przycisk[1] then
outputChatBox ( "Kupiles auto.", 255, 0, 0, true)
triggerServerEvent("auto", getRootElement(), player,ed)
end
end
addEventHandler ( "onClientGUIClick", przycisk[1], auto_f)

[ Dodano: 2013-04-29, 16:27 ]
Poprawka:
Server

function auto_f()
if source == przycisk[1] then
player = getLocalPlayer()
ed = guiGetText ( edit )
outputChatBox ( "Kupiles auto.", 255, 0, 0, true)
triggerServerEvent("auto", getRootElement(), player,ed)
end
end
addEventHandler ( "onClientGUIClick", przycisk[1], auto_f)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 17:52


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Oski, mam pytanie sk?d ty masz zmian? edit jak nie masz w jej w funkcji ?? chodzi o strun? serwer.

albo masz z?e napisane strony popraw to.


"Oski" napisał/a:

CLIENT
function auto_f_s (player,edit)
local kasa = getPlayerMoney ( player )
local x,y,z = getElementPosition ( player )
if kasa >= 10000 then
createVehicle ( tonumber( edit ), x, y+2, z )
else
outputChatBox ( "Nie posiadasz 10000$", player )
end
end
addEvent("auto", true)
addEventHandler("auto", getRootElement(), auto_f_s)

SERVER
function auto_f()
if source == przycisk[1] then
outputChatBox ( "Kupiles auto.", 255, 0, 0, true)
triggerServerEvent("auto", getRootElement(), player,ed)
end
end
addEventHandler ( "onClientGUIClick", przycisk[1], auto_f)

[ Dodano: 2013-04-29, 16:27 ]
Poprawka:
Server

function auto_f()
if source == przycisk[1] then
player = getLocalPlayer()
ed = guiGetText ( edit )
outputChatBox ( "Kupiles auto.", 255, 0, 0, true)
triggerServerEvent("auto", getRootElement(), player,ed)
end
end
addEventHandler ( "onClientGUIClick", przycisk[1], auto_f)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 18:04


Oski

LUA Scripter






Wiek: 30
Na forum: 5387 dni
Posty: 428
Nick w MP: Oski

Piwa: 56

Respekt: 75,1

"luki123luki123" napisał/a:

Oski, mam pytanie sk?d ty masz zmian? edit jak nie masz w jej w funkcji ?? chodzi o strun? serwer.

albo masz z?e napisane strony popraw to.


"Oski" napisał/a:

CLIENT
function auto_f_s (player,edit)
local kasa = getPlayerMoney ( player )
local x,y,z = getElementPosition ( player )
if kasa >= 10000 then
createVehicle ( tonumber( edit ), x, y+2, z )
else
outputChatBox ( "Nie posiadasz 10000$", player )
end
end
addEvent("auto", true)
addEventHandler("auto", getRootElement(), auto_f_s)

SERVER
function auto_f()
if source == przycisk[1] then
outputChatBox ( "Kupiles auto.", 255, 0, 0, true)
triggerServerEvent("auto", getRootElement(), player,ed)
end
end
addEventHandler ( "onClientGUIClick", przycisk[1], auto_f)

[ Dodano: 2013-04-29, 16:27 ]
Poprawka:
Server

function auto_f()
if source == przycisk[1] then
player = getLocalPlayer()
ed = guiGetText ( edit )
outputChatBox ( "Kupiles auto.", 255, 0, 0, true)
triggerServerEvent("auto", getRootElement(), player,ed)
end
end
addEventHandler ( "onClientGUIClick", przycisk[1], auto_f)


Je?li ju? to nie server tylko client.
Racja pomy?ka.
B??dy ka?demu si? zda?aj?.
Dzi?kuje ?e zauwazy?e?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 18:08


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Wciaz 0 reakcji w debugu jak i w skrypcie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 18:19


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Ciastkooo, daj kod kt?ry teraz masz

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 18:57


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Wkleilem ten ktory mi dal Oski :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-29, 19:19


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Ciastkooo, daj ca?y bo mo?e ty masz b??d

Postaw piwo autorowi tego posta
 

 
Tagi: panel
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