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

Wysłany: 2015-08-31, 16:39


reasterx2







Wiek: 31
Na forum: 3942 dni
Posty: 2
Nick w MP: reasterx



Respekt: 50

Cze?? mam problem mam skrypt na gielde i mo?na bugowac sobie kas? np ktos wpisze cene na - i buguje kase


local sXsY guiGetScreenSize()

function createGUIGielda()
    if not guig then
    guig = {}
    guig[1] = guiCreateWindow((sX 350)/2, (sY 360)/2350360"Sprzeda? pojazdu"false)
    guig[2] = guiCreateLabel(102333040"Wybierz z listy graczy, kt?rzy znajduj? si? w makerze tego, komu chcesz sprzeda? pojazd."falseguig[1])
    guiLabelSetHorizontalAlign(guig[2], "center"true)
    guig[3] = guiCreateGridList(1060330250falseguig[1])
    guig[4] = guiGridListAddColumn(guig[3], "Gracze"0.9)
    guig[5] = guiCreateButton(103208030"Zamknij"falseguig[1])
    guig[6] = guiCreateButton(2603208030"Dalej"falseguig[1])
    
    addEventHandler("onClientGUIClick"guig[5], onSprzedazClickZamknijfalse)
    addEventHandler("onClientGUIClick"guig[6], onSprzedazClickGraczeDalejfalse)
    
    --wybieranie pojazdu
    guig[7] = guiCreateWindow((sX 350)/2, (sY 360)/2350360"Sprzeda? pojazdu"false)
    guig[8] = guiCreateLabel(102333040"Z listy pojazd?w wybierz pojazd, kt?ry chcesz sprzeda?"falseguig[7])
    guiLabelSetHorizontalAlign(guig[8], "center"true)
    guig[9] = guiCreateGridList(1060330250falseguig[7])
    guig[10] = guiGridListAddColumn(guig[9], "Twoje pojazdy"0.9)
    guig[11] = guiCreateButton(103208030"Zamknij"falseguig[7])
    guig[12] = guiCreateButton(2603208030"Dalej"falseguig[7])
    
    addEventHandler("onClientGUIClick"guig[11], onSprzedazClickZamknijfalse)
    addEventHandler("onClientGUIClick"guig[12], onSprzedazClickPojazdyDalejfalse)
    
    --cena
    guig[13] = guiCreateWindow((sX 280)/2, (sY 190)/2280190"Sprzeda? pojazdu"false)
    guig[14] = guiCreateLabel(102326040"Wpisz cen? pojazdu, za kt?r? chcesz sprzeda? Tw?j pojazd."falseguig[13])
    guiLabelSetHorizontalAlign(guig[14], "center"true)
    guig[15] = guiCreateLabel(15753020"Cena:"falseguig[13])
    guig[16] = guiCreateEdit(527112030""falseguig[13])
    guig[17] = guiCreateButton(101508030"Zamknij"falseguig[13])
    guig[18] = guiCreateButton(1901508030"Sprzedaj"falseguig[13])
    
    addEventHandler("onClientGUIClick"guig[17], onSprzedazClickZamknijfalse)
    addEventHandler("onClientGUIClick"guig[18], onSprzedazClickSprzedajfalse)
    end
guiSetVisible(guig[1], false)
guiSetVisible(guig[7], false)
guiSetVisible(guig[13], false)
guiGridListClear(guig[3])
guiGridListClear(guig[9])
guiSetText(guig[16], "")
showCursor(true)
end

addEvent("pokazGUISprzedazy"true)
addEventHandler("pokazGUISprzedazy"getRootElement(),
function(players)
createGUIGielda()
guiSetVisible(guig[1], true)
    for i,v in pairs(players) do
        --if ~= localPlayer then
        local row guiGridListAddRow(guig[3])
        guiGridListSetItemText(guig[3], rowguig[4], getPlayerName(v), falsefalse)
        guiGridListSetItemData(guig[3], rowguig[4], v)
        --end
    end
end)

function onSprzedazClickZamknij()
savePLAYER nil
saveVEHICLE nil

guiSetVisible(guig[1], false)
guiSetVisible(guig[7], false)
guiSetVisible(guig[13], false)
showCursor(false)
end

function onSprzedazClickGraczeDalej()
local rowcolumn guiGridListGetSelectedItem(guig[3])
    if row ~= -1 then
    local player guiGridListGetItemData(guig[3], rowguig[4])
        if player then
        savePLAYER player
        triggerServerEvent("pobierzListePojazdow"localPlayerid)
        end
    end
end

--<< pojazdy >>--

addEvent("pokazListePojazdow"true)
addEventHandler("pokazListePojazdow"getRootElement(),
function(pojazdy)
guiSetVisible(guig[1], false)
guiSetVisible(guig[7], true)
    for i,v in pairs(pojazdy) do
    local row guiGridListAddRow(guig[9])
    guiGridListSetItemText(guig[9], rowguig[10], getVehicleNameFromModel(v["model"]), falsefalse)
    guiGridListSetItemData(guig[9], rowguig[10], v["id"])
    end
end)

function onSprzedazClickPojazdyDalej()
local rowcolumn guiGridListGetSelectedItem(guig[9])
    if row ~= -1 then
    local id guiGridListGetItemData(guig[9], rowguig[10])
        if id then
        saveVEHICLE id
        
        guiSetVisible(guig[7], false)
        guiSetVisible(guig[13], true)
        guiSetText(guig[16], "")
        end
    end
end

--<< cena
function onSprzedazClickSprzedaj()
local cena guiGetText(guig[16])
    if #cena >= 1 then
    local cena tonumber(cena)
        if type(cena) == "number" then
        showCursor(false)
        guiSetVisible(guig[13], false)
        --
        triggerServerEvent("zaproponujKupnoPojazdu"localPlayersavePLAYERsaveVEHICLEcena)
        else
        outputChatBox("Wpisz cen? za jak? chcesz sprzeda? sw?j pojazd."255255255true)
        end
    end
end


--######## OFERTA KUPNA #########
function createGUIKupnoUzywanego()
    if not guiku then
    guiku = {}
    
    guiku[1] = guiCreateWindow((sX 300)/2, (sY 150)/2300150"Oferta kupna pojazdu"false)
    guiku[2] = guiCreateLabel(102528060"Gracz <nick> zaproponowa? Ci kupno pojazdu prywatnego <nazwa> o przebiegu <przebieg> km za <cena> Euro."falseguiku[1])
    guiLabelSetHorizontalAlign(guiku[2], "center"true)
    guiku[3] = guiCreateButton(101108030"Odrzu?"falseguiku[1])
    guiku[4] = guiCreateButton(2101108030"Kup"falseguiku[1])
    
    addEventHandler("onClientGUIClick"guiku[3], onOfertaKupnaOdrzucfalse)
    addEventHandler("onClientGUIClick"guiku[4], onOfertaKupnaKupfalse)
    end
guiSetVisible(guiku[1], true)
showCursor(true)
end

addEvent("pokazOferteKupnaPojazdu"true)
addEventHandler("pokazOferteKupnaPojazdu"getRootElement(),
function(gracznazwacenaprzebieg)
createGUIKupnoUzywanego()
guiSetText(guiku[2], "Gracz "..getPlayerName(gracz).." zaproponowa? Ci kupno pojazdu prywatnego "..nazwa.." o przebiegu "..przebieg.." km za "..cena.." Euro.")
end)

function onOfertaKupnaZamknij()
guiSetVisible(guiku[1], false)
showCursor(false)
end

function onOfertaKupnaOdrzuc()
onOfertaKupnaZamknij()
triggerServerEvent("odrzucOferteKupna"localPlayer)
end

function onOfertaKupnaKup()
onOfertaKupnaZamknij()
triggerServerEvent("przyjmijOferteKupna"localPlayer)
end


local sprzedaz createMarker(114.25781251110.993896484414.695250511169"cylinder"225500100)
function onSprzedazHit(hitElementdim)
    if getElementType(hitElement) == "player" then
    local players getElementsInMarker(sprzedaz)
    triggerClientEvent(hitElement"pokazGUISprzedazy"rootplayers)
    end
end
addEventHandler("onMarkerHit"sprzedazonSprzedazHit)

function getElementsInMarker(marker)
elements = {}
    for i,v in pairs(getElementsByType("player")) do
        if isElementWithinMarker(vmarkerthen
        table.insert(elementsv)
        end
    end
return elements
end

addEvent("pobierzListePojazdow"true)
addEventHandler("pobierzListePojazdow"getRootElement(), 
function()
local account getPlayerAccount(source)
    if account then
    local wlasciciel getAccountName(account)
    local query dbQuery(handler"SELECT * FROM pojazdy WHERE wlasciciel='"..wlasciciel.."'")
    local resultnum_rowserrormsg dbPoll (query, -1)
    triggerClientEvent(source"pokazListePojazdow"rootresult)
    end
end)

ofertyKupna = {}

addEvent("zaproponujKupnoPojazdu"true)
addEventHandler("zaproponujKupnoPojazdu"getRootElement(),
function(graczidcena)
    if not ofertyKupna[graczthen
    ofertyKupna[gracz] = {}
    ofertyKupna[gracz] = {graczsourceidcena}
    
    local query dbQuery(handler"SELECT model,przebieg FROM pojazdy WHERE id='"..id.."'")
    local resultnum_rowserrormsg dbPoll (query, -1)
    local pojazd result[1].model
    local pojazd getVehicleNameFromModel(pojazd)
    local przebieg result[1].przebieg
    triggerClientEvent(gracz"pokazOferteKupnaPojazdu"rootsourcepojazdcenaprzebieg)
    else
    outputChatBox("Ten gracz w tym momencie ma otwart? inn? ofert? kupna pojazdu..."source255255255true)
    end
end)

addEvent("odrzucOferteKupna"true)
addEventHandler("odrzucOferteKupna"getRootElement(),
function()
    if ofertyKupna[sourcethen
    local od_kogo_oferta ofertyKupna[source][2]
        if isElement(od_kogo_ofertathen
        outputChatBox("Gracz "..getPlayerName(source).." odrzuci? Twoj? ofert? kupna pojazdu."od_kogo_oferta255255255true)
        end
    ofertyKupna[source] = nil
    end
end)

addEvent("przyjmijOferteKupna"true)
addEventHandler("przyjmijOferteKupna"getRootElement(),
function()
    if ofertyKupna[sourcethen
    local account getPlayerAccount(source)
      if account then
      local login getAccountName(account)
        if 10000 >= getYourVehicleCount(loginthen
        local od_kogo_oferta ofertyKupna[source][2]
        local veh ofertyKupna[source][3] --id pojazdu
        local cena ofertyKupna[source][4]
            if isElement(od_kogo_ofertathen
            local cena tonumber(cena)
                if getPlayerMoney(source) >= cena then
                end
                if cena>0 then
                takePlayerMoney(sourcecena)
                givePlayerMoney(od_kogo_ofertacena)
                --nadpisanie danych
                local vehicle getVehicleByID(veh)
                ustawDanePojazdu(vehiclevehlogin)
                dbExec(handler"UPDATE pojazdy SET wlasciciel='"..login.."' WHERE id="..veh.."")
                --chat
                local pojazd getVehicleName(vehicle)
                outputChatBox("Gracz "..getPlayerName(source).." przyja? Twoj? ofert? i kupi? Tw?j pojazd "..pojazd.." za "..cena.." Euro."od_kogo_oferta255255255true)
                outputChatBox("Kupi?e? pojazd "..pojazd.." za "..cena.." Euro od gracza "..getPlayerName(od_kogo_oferta).."."source255255255true)
                else
                outputChatBox("Gracz "..getPlayerName(source).." nie ma wystarczaj?co pieni?dzy by kupi? Tw?j pojazd."od_kogo_oferta255255255true)
                outputChatBox("Nie masz wystarczaj?co pieni?dzy by kupi? ten pojazd."source255255255true)
                end
            else
            outputChatBox("Gracz kt?ry sk?ada? Ci ofert? nie jest ju? online na serwerze."source255255255true)
            end
        else
        outputChatBox("Mo?esz posiada? maksymalnie 5 pojazd?w."source255255255true)
        end
      else
      outputChatBox("Nie jeste? zalogowany."source255255255true)
      end
    else
    outputChatBox("Wyst?pi? b??d, nie mo?esz teraz kupi? pojazdu :|"source255255 ,255true)
    end
ofertyKupna[source] = nil
end
end)



i jeszcze nie wyswietla nicku auta lub przebiegu w okienku propozycji kupna za pomoc piwko i respekt !


//Poprawione znaczniki Lua//DestroY

Ostatnio zmieniony przez #404 2015-08-31, 17:57, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-31, 17:58


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3


if #cena >= 1 then


Usu? z tej linijki "#" bo to pobiera liczb? np. warto?ci w tabeli.

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-31, 18:34


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

if cena 0 then


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-31, 20:23


reasterx2







Wiek: 31
Na forum: 3942 dni
Posty: 2
Nick w MP: reasterx



Respekt: 50

Nadal nic mo?na sprzedawa? na - lub nie dzia?a sprzedaz na plus i minus...

Dodam ,?e mam taki sam problem http://gtao.pl/bugowanie-...azy-vt97782.htm ,a jak robie to samo co tam pisaliscie nie dziala mi ;C helpp

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-31, 20:47


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Pokaz obecny kod.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-31, 21:15


luki123luki123

Place Game






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

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

if tonumber(cena) > 0 then


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-01, 16:44


Kurczak23







Wiek: 32
Na forum: 5032 dni
Posty: 30

Piwa: 499

Respekt: 115,3
Respekt: 115,3

Trzymaj!


local cena=tonumber(guiGetText(guig[16]))
if cena == nil then return outputChatBox("Warto?? pojazdu musi by? napisana w liczbach."255255255trueend
if cena <= 0 then return outputChatBox("Warto?? pojazdu nie mo?e by? mniejsza ni? 1."255255255trueend 


Postaw piwo autorowi tego posta
 

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