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

Wysłany: 2015-08-28, 11:16


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4470 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Jakie? sugestie ?

local sprzedaz = createMarker(940.18,2253.33,9.90, "cylinder", 2, 255, 0, 0, 100)

function onSprzedazHit(hitElement, dim)
    if getElementType(hitElement) == "player" then
    local players = getElementsInMarker(sprzedaz)
    triggerClientEvent(hitElement, "pokazGUISprzedazy", root, players)
    end
end
addEventHandler("onMarkerHit", sprzedaz, onSprzedazHit)

function getElementsInMarker(marker)
elements = {}
    for i,v in pairs(getElementsByType("player")) do
        if isElementWithinMarker(v, marker) then
        table.insert(elements, v)
        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 result, num_rows, errormsg = dbPoll (query, -1)
    triggerClientEvent(source, "pokazListePojazdow", root, result)
    end
end)

ofertyKupna = {}

addEvent("zaproponujKupnoPojazdu", true)
addEventHandler("zaproponujKupnoPojazdu", getRootElement(),
function(gracz, id, cena)
    if not ofertyKupna[gracz] then
    ofertyKupna[gracz] = {}
    ofertyKupna[gracz] = {gracz, source, id, cena}
    
    local query = dbQuery(handler, "SELECT model FROM pojazdy WHERE id='"..id.."'")
    local result, num_rows, errormsg = dbPoll (query, -1)
    local pojazd = result[1].model
    local pojazd = getVehicleNameFromModel(pojazd)
    local przebieg = result[1].przebieg
    triggerClientEvent(gracz, "pokazOferteKupnaPojazdu", root, source, pojazd, cena, przebieg)
    else
    outputChatBox("Ten gracz w tym momencie ma otwart? inn? ofert? kupna pojazdu...", source, 255, 255, 255, true)
    end
end)
ofertyKupna[gracz] = {}
    ofertyKupna[gracz] = {gracz, source, id, cena}
    if cena < 1 then


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

addEvent("przyjmijOferteKupna", true)
addEventHandler("przyjmijOferteKupna", getRootElement(),
function()
    if ofertyKupna[source] then
    local account = getPlayerAccount(source)
      if account then
      local login = getAccountName(account)
        if 50 >= getYourVehicleCount(login) then
        local od_kogo_oferta = ofertyKupna[source][2]
        local veh = ofertyKupna[source][3] --id pojazdu
        local cena = ofertyKupna[source][4]
            if isElement(od_kogo_oferta) then
            local cena = tonumber(cena)
                if getPlayerMoney(source) >= cena then
                takePlayerMoney(source, cena)
                givePlayerMoney(od_kogo_oferta, cena)
                --nadpisanie danych
                local vehicle = getVehicleByID(veh)
                ustawDanePojazdu(vehicle, veh, login)
                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.."$.", od_kogo_oferta, 255, 255, 255, true)
                outputChatBox("Kupi?e? pojazd "..pojazd.." za "..cena.."$ od gracza "..getPlayerName(od_kogo_oferta)..".", source, 255, 255, 255, true)
                else
                outputChatBox("Gracz "..getPlayerName(source).." nie ma wystarczaj?co pieni?dzy by kupi? Tw?j pojazd.", od_kogo_oferta, 255, 255, 255, true)
                outputChatBox("Nie masz wystarczaj?co pieni?dzy by kupi? ten pojazd.", source, 255, 255, 255, true)
                end
            else
            outputChatBox("Gracz kt?ry sk?ada? Ci ofert? nie jest ju? online na serwerze.", source, 255, 255, 255, true)
            end
        else
        outputChatBox("Mo?esz posiada? maksymalnie 5 pojazd?w.", source, 255, 255, 255, true)
        end
      else
      outputChatBox("Nie jeste? zalogowany.", source, 255, 255, 255, true)
      end
    else
    outputChatBox("Wyst?pi? b??d, nie mo?esz teraz kupi? pojazdu :|", source, 255, 255 ,255, true)
    end
ofertyKupna[source] = nil
end
end)


DB : http://www.wrzucajtu.pl/w...28_11-14-52.png

te ostatnie db :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-28, 11:37


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4535 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Opisz dok?adnie co nie dzia?a...

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-28, 11:38


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4470 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Wi?c nie tworzy si? marker nwm dla czego ;(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-28, 12:35


MIKAELmta







Wiek: 25
Na forum: 4120 dni
Posty: 311

Piwa: 10631

Respekt: 355,3
Respekt: 355,3Respekt: 355,3Respekt: 355,3Respekt: 355,3

Sprawdza?e?, czy na pewno wpisa?e? dobrze kordy?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-28, 12:36


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4470 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

tak.. ale s? db poda?em w 1 po?cie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-28, 13:37


Terr9909

Skrypter LUA






Wiek: 27
Na forum: 4375 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

What? Co to jest?
end)
ofertyKupna[gracz] = {}
    ofertyKupna[gracz] = {gracz, source, id, cena}
    if cena < 1 then


Postaw piwo autorowi tego posta
 

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