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

Wysłany: 2015-09-04, 21:32


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
Siema. Kolejny i (mam nadziej?) ostatni problem. A raczej 2.

1. Jak kto? wjedzie w marker pokazuj?cy GUI to ka?demu si? pokazuje
2. Nie dzia?aj? markery na usuni?cie opisu

Kod:

local sw,sh = guiGetScreenSize()
local gieldaMarker = createMarker( 994.17,2205.20,10.41, "cylinder" ,5, 25, 111,25,25 )
local strefa = createColSphere ( 929.29455566406, 2204.35546875, 12.280563354492 , 5, 4.5, 2)

local usuniecie_opisu = {
{929.29455566406, 2204.35546875, 11.58056335449},
{994.18,2200.49,10.42},
}
for k, v in ipairs (usuniecie_opisu) do
      local cuboid123 = createMarker ( v[1], v[2], v[3], "cylinder", 3, 255, 255, 0, 100)
end
addCommandHandler( "vopisusun",
  function ( el,md)
    if not md or el ~= localPlayer then return end
    if not wstep then return end
    local veh=getPedOccupiedVehicle(el)
    if not veh then return end
    setElementData(veh,"pojazd_opis",false)
  end
)

buttonWystaw = guiCreateButton(1142/1440*sw, 479/900*sh, 264/1440*sw, 94/900*sh, "Wstaw Cene!", false)

editWystaw = guiCreateEdit(1137/1440*sw, 383/900*sh, 278/1440*sw, 64/900*sh, "", false)    

guiSetVisible(buttonWystaw, false)
guiSetVisible(editWystaw, false)

function dxPokaz()

        dxDrawRectangle(1124/1440*sw, 284/900*sh, 306/1440*sw, 311/900*sh, tocolor(0, 0, 0, 198), false)
        dxDrawRectangle(1112/1440*sw, 256/900*sh, 328/1440*sw, 28/900*sh, tocolor(163, 73, 0, 207), false)
        dxDrawText("Black Life[PL]", 1111/1440*sw, 254/900*sh, 1440/1440*sw, 284/900*sh, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1127/1440*sw, 284/900*sh, 1427/1440*sw, 377/900*sh, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1127/1440*sw, 282/900*sh, 1427/1440*sw, 375/900*sh, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1125/1440*sw, 284/900*sh, 1425/1440*sw, 377/900*sh, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1125/1440*sw, 282/900*sh, 1425/1440*sw, 375/900*sh, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1126/1440*sw, 283/900*sh, 1426/1440*sw, 376/900*sh, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
end


addEventHandler("onClientMarkerLeave", gieldaMarker, function(el, md)
    if guiGetVisible(buttonWystaw) == true then
        guiSetVisible(buttonWystaw, false)
        guiSetVisible(editWystaw, false)
        showCursor(false)
        removeEventHandler('onClientRender', root, dxPokaz)
    end
end)

addEventHandler('onClientMarkerHit', gieldaMarker, function(hitElement, matchingDimension)
    if hitElement == localPlayer then
            local pojazdy = getElementsWithinColShape(strefa,"vehicle")
            if #pojazdy>40 then
                outputChatBox("Na gie?dzie jest 40 Aut. Poczekaj a? si? zwoli miejsce")
                return
            end
            guiSetVisible(buttonWystaw, true)
            guiSetVisible(editWystaw, true)
            showCursor(true, false)
            addEventHandler("onClientRender", root, dxPokaz)
    end
end)

function wystaw( )
    local cenaPobierz = guiGetText ( editWystaw )
    local cena = tonumber(cenaPobierz)
    local pojazd = getPedOccupiedVehicle(localPlayer)
    local car = getVehicleName(pojazd)
    local owner = getElementData(pojazd, "car_owner")
    local id = getElementData(pojazd, "car_id")
    local przebiegg = getElementData(pojazd, "pojazd_przebieg")
    local przebieg = math.floor(przebiegg)
    if cena >500 then
    --triggerServerEvent ( "wystawEvent", resourceRoot, pojazd, cena, wlasciciel, id, przebieg )
    setElementData(pojazd,"pojazd_opis","------------------\nPojazd: "..car.."\nCena: "..cena.."ZL\nPrzebieg: "..przebieg.."km\nSprzedaj?cy: "..owner.."\nID Pojazdu: "..id.."\n------------------" )
    --"Cena: "..cena.."$\nPrzebieg: "..przebieg.."km\nSprzedaj?cy: "..owner.."\nID Pojazdu: "..id.."" )
    else --jesli cena to nie 750
    outputChatBox("* Cena minimalna wynosi 500 PLN!")
end
end
addEventHandler ( "onClientGUIClick", buttonWystaw , wystaw )

--33
addEventHandler('onClientMarkerHit', cuboid123, function(el,md)
    if not md or el ~= localPlayer then return end
    if wstep then return end
    wstep=true
end)

addEventHandler("onClientMarkerHit", cuboid123, function(el,md)
    if not md or el ~= localPlayer then return end
    if not wstep then return end
    local veh=getPedOccupiedVehicle(el)
    if not veh then return end
    setElementData(veh,"pojazd_opis",false)
end)


Za pomoc dam :piwo: i R* :)

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-04, 22:06


Kurczak23







Wiek: 32
Na forum: 5173 dni
Posty: 30

Piwa: 499

Respekt: 115,3
Respekt: 115,3


--[[
ZMIANY JAKIE ZROBI?EM TO WYWALENIE NIE POTRZEBNYCH RZECZY (JAKIES MARKERY oraz np PRZEBIEGG w funkcji wystaw) , PRZEROBIENIE ICH (dziwna komenda vopisusun) ORAZ DODANIE OPTYMALIZACJI DLA KODU PATRZ FUNKCJA dxPokaz
DODALEM USUNIECIE NAPISU
]]--

--- Ustawienia

local sw,sh = guiGetScreenSize()
local gieldaMarker = createMarker( 994.17,2205.20,10.41, "cylinder" ,5, 25, 111,25,25 )
local strefa = createColSphere ( 929.29455566406, 2204.35546875, 12.280563354492 , 5, 4.5, 2)

addEventHandler("onResourceStart", root, function()
buttonWystaw = guiCreateButton(1142/1440*sw, 479/900*sh, 264/1440*sw, 94/900*sh, "Wstaw Cene!", false)

editWystaw = guiCreateEdit(1137/1440*sw, 383/900*sh, 278/1440*sw, 64/900*sh, "", false)    

guiSetVisible(buttonWystaw, false)
guiSetVisible(editWystaw, false)
end)
--- END


function dxPokaz()
        --dxSetAspectRatioAdjustmentEnabled( true ) --OD BEZPIECZ TO JEZELI CHCESZ BY TWOJ KOD BYL ZGODNY Z WSZYSTKIMI ROZDZIELCZOSCIAMI
        dxDrawRectangle(1124/1440*sw, 284/900*sh, 306/1440*sw, 311/900*sh, tocolor(0, 0, 0, 198), false)
        dxDrawRectangle(1112/1440*sw, 256/900*sh, 328/1440*sw, 28/900*sh, tocolor(163, 73, 0, 207), false)
        dxDrawText("Black Life[PL]", 1111/1440*sw, 254/900*sh, 1440/1440*sw, 284/900*sh, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1127/1440*sw, 284/900*sh, 1427/1440*sw, 377/900*sh, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1127/1440*sw, 282/900*sh, 1427/1440*sw, 375/900*sh, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1125/1440*sw, 284/900*sh, 1425/1440*sw, 377/900*sh, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1125/1440*sw, 282/900*sh, 1425/1440*sw, 375/900*sh, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
        dxDrawText("Wpisz cen? auta jaka ci? interesuje\n(Minimum 500$)", 1126/1440*sw, 283/900*sh, 1426/1440*sw, 376/900*sh, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
end


addEventHandler("onClientMarkerLeave", gieldaMarker, function(el, md)
    if el ~= localPlayer then return end
    guiSetVisible(buttonWystaw, false)
    guiSetVisible(editWystaw, false)
    showCursor(false)
    removeEventHandler("onClientRender", localPlayer, dxPokaz)
end)

addEventHandler('onClientMarkerHit', gieldaMarker, function(hitElement, matchingDimension)
    if hitElement ~= localPlayer then return end
        local pojazdy = getElementsWithinColShape(strefa,"vehicle")
        if #pojazdy>40 then
            outputChatBox("Na gie?dzie jest 40 Aut. Poczekaj a? si? zwoli miejsce")
            return
        end
        guiSetVisible(buttonWystaw, true)
        guiSetVisible(editWystaw, true)
        showCursor(true, false)
        addEventHandler("onClientRender", localPlayer, dxPokaz)
end)

function wystaw( )
    local cenaPobierz = guiGetText ( editWystaw )
    local cena = tonumber(cenaPobierz)
    local pojazd = getPedOccupiedVehicle(localPlayer)
    local car = getVehicleName(pojazd)
    local owner = getElementData(pojazd, "car_owner")
    local id = getElementData(pojazd, "car_id")
    local przebieg = math.floor(getElementData(pojazd, "pojazd_przebieg"))
    if cena >500 then
    --triggerServerEvent ( "wystawEvent", resourceRoot, pojazd, cena, wlasciciel, id, przebieg )
    setElementData(pojazd,"pojazd_opis","------------------\nPojazd: "..car.."\nCena: "..cena.."ZL\nPrzebieg: "..przebieg.."km\nSprzedaj?cy: "..owner.."\nID Pojazdu: "..id.."\n------------------" )
    setElementData(pojazd,"pojazd_gielda", true)
    --"Cena: "..cena.."$\nPrzebieg: "..przebieg.."km\nSprzedaj?cy: "..owner.."\nID Pojazdu: "..id.."" )
    else --jesli cena to nie 750
    outputChatBox("* Cena minimalna wynosi 500 PLN!")
end
end
addEventHandler ( "onClientGUIClick", buttonWystaw , wystaw )

addEventHandler("onClientColShapeLeave", strefa, function(el,md)
    if not md or el ~= localPlayer then return end
    local veh=getPedOccupiedVehicle(el)
    if not veh then return end
    if getElementData(veh, "pojazd_gielda") then setElementData(veh, "pojazd_opis", false); setElementData(veh,"pojazd_gielda", false) return end
end)

addCommandHandler( "vopisusun",function(cmd,_)
    local veh=getPedOccupiedVehicle(localPlayer)
    if not veh then outputChatBox("* Najpierw musisz byc w pojezdzie") return end
    setElementData(veh,"pojazd_opis",false)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-05, 10:39


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
1. :32: Bad Argument @ 'guiSetVisible' [Expected gui-element at argument 1, got nil]
2. W?a?nie nie pokazuje si? to gui
3. A gdzie s? te markery na usuni?cie opisu??

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-05, 13:09


Kurczak23







Wiek: 32
Na forum: 5173 dni
Posty: 30

Piwa: 499

Respekt: 115,3
Respekt: 115,3

Wybacz moje b??dy jak masz onresourcestart zamien na onClientResourceStart
oraz przy addeventhandler z dxpokaz tam masz localPlayer mozesz sobie zamienic na root

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-05, 15:02


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"Kurczak23" napisał/a:


oraz przy addeventhandler z dxpokaz tam masz localPlayer mozesz sobie zamienic na root


A to gdzie jest? :-?

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Tagi: giełda
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