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

Wysłany: 2019-04-13, 12:32


killercycDDS

Migacz






Wiek: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

Respekt: 22

ehh witam znowu przychodz? z problemem z nickiem teraz tylko po sprzedaniu auta na gie?dzie


local czyj = getPlayerName(source):gsub("#%x%x%x%x%x%x","")
exports["marinarpg-db"]:dbSet("UPDATE marinarpg_pojazdy SET czyj=? WHERE id=?", vehicle:getData("player:sid"), vehicle:getData("vehicle:id"), czyj)

znowu zwraca samo uid ;-;

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-13, 13:00


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3348 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

killercycDDS,


local czyj = getPlayerName(source):gsub("#%x%x%x%x%x%x","")
exports["marinarpg-db"]:dbSet("UPDATE marinarpg_pojazdy SET czyj=? WHERE id=?", czyj, vehicle:getData("vehicle:id"))



Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-13, 23:43


killercycDDS

Migacz






Wiek: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

Respekt: 22

heros123345, dalej nic zmienia z nicku na 0

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 02:06


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3348 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

killercycDDS, poka? w bazie MySQL to "czyj"

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 02:35


killercycDDS

Migacz






Wiek: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

Respekt: 22

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 03:30


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3348 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

killercycDDS, musisz da? ca?y kod sprzeda?y.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 10:33


killercycDDS

Migacz






Wiek: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

Respekt: 22

heros123345,

local cuboid = {}
local cub = ColShape.Cuboid(-2302.0866699219, -179.67449951172, 34.3203125, 32, 75.75, 4)
createBlip(-2286.65, -179.95, 35.32, 43, 25, 0, 0, 0, 0, 0, 175)

function RGBToHex(red, green, blue, alpha)
    if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end
    if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha) else return string.format("#%.2X%.2X%.2X", red, green, blue) end
end

addEvent("iyw_vehicles_exchange:buy_vehicle", true)
addEventHandler("iyw_vehicles_exchange:buy_vehicle", root, function(vehicle)
    local exchange = vehicle:getData("vehicle:exchange")
    --local czyj = getPlayerName(source):gsub("#%x%x%x%x%x%x","")
    if not exchange then return false end
    
    if source.money < tonumber(exchange.cost) then
        return triggerClientEvent(source, "onClientAddNotification", source, "Nie posiadasz tyle got?wki\nby m?c zakupi? ten pojazd! ("..tonumber(exchange.cost).."PLN)", "error")
    elseif source.name == exchange.owner then
        return triggerClientEvent(source, "onClientAddNotification", source, "Nie mo?esz kupi? swojego pojazdu!", "error")
    end
    
    vehicle:setData("vehicle:ownedPlayer", source:getData("player:sid"))
    warpPedIntoVehicle(source, vehicle, 0)
    source:takeMoney(exchange.cost)
    
    if getPlayerFromName(exchange.owner) and getPlayerFromName(exchange.owner):getData("player:logged") then
        triggerClientEvent(getPlayerFromName(exchange.owner), "onClientAddNotification", getPlayerFromName(exchange.owner), "U?ytkownik "..string.gsub(source.name, "#%x%x%x%x%x%x", "").."\nkupi? Tw?j pojazd, otrzymujesz "..exchange.cost.."PLN do portfela.", "success")
        --givePlayerMoney(getPlayerFromName(exchange.owner), exchange.cost)
        triggerEvent("admin:addText", resourceRoot, RGBToHex(0, 200, 0)..("(GIE?DA) %s kupi? pojazd %s [ID: %s] od %s (%s PLN)"):format(source.name:gsub("#%x%x%x%x%x%x",""), vehicle:getName(), vehicle:getData("vehicle:id"), exchange.owner, exchange.cost, text)..RGBToHex(255, 255, 255), math.random(0,99))
        triggerClientEvent("onDebugMessage", resourceRoot, ("(GIE?DA) %s kupi? pojazd %s [ID: %s] od %s (%s PLN)"):format(source.name:gsub("#%x%x%x%x%x%x",""), vehicle:getName(), vehicle:getData("vehicle:id"), exchange.owner, exchange.cost, text), 5, "INNE")
        exports["marinarpg-db"]:dbSet("update marinarpg_lista_graczy set bank_money=bank_money+? where id=? limit 1",exchange.cost, exchange.data)
    else
        exports["marinarpg-db"]:dbSet("update marinarpg_lista_graczy set bank_money=bank_money+? where id=? limit 1",exchange.cost, exchange.data)
        local czyj = getPlayerName(source):gsub("#%x%x%x%x%x%x","")
        exports["marinarpg-db"]:dbSet("UPDATE marinarpg_pojazdy SET czyj=? WHERE id=?", czyj, vehicle:getData("vehicle:id"))
        --exports["marinarpg-db"]:dbSet("update marinarpg_pojazdy set czyj=? where id=? limit 1",czyj)
        triggerEvent("admin:addText", resourceRoot, RGBToHex(0, 200, 0)..("(GIE?DA) %s kupi? pojazd %s [ID: %s] od %s (%s PLN)"):format(source.name:gsub("#%x%x%x%x%x%x",""), vehicle:getName(), vehicle:getData("vehicle:id"), exchange.owner, exchange.cost, text)..RGBToHex(255, 255, 255), math.random(0,99))
        triggerClientEvent("onDebugMessage", resourceRoot, ("(GIE?DA) %s kupi? pojazd %s [ID: %s] od %s (%s PLN)"):format(source.name:gsub("#%x%x%x%x%x%x",""), vehicle:getName(), vehicle:getData("vehicle:id"), exchange.owner, exchange.cost, text), 5, "INNE")
    end
    
    exports["marinarpg-db"]:dbSet("UPDATE marinarpg_pojazdy SET ownedPlayer=?, ownedGroup=0, rent=0, parking=1 WHERE id=?", source:getData("player:sid"), vehicle:getData("vehicle:id"))
    exports["marinarpg-db"]:dbSet("UPDATE marinarpg_pojazdy SET czyj=? WHERE id=?", vehicle:getData("player:sid"), vehicle:getData("vehicle:id"), czyj)
    if cuboid[vehicle] and isElement(cuboid[vehicle]) then cuboid[vehicle]:destroy() end
    vehicle:setData("vehicle:exchange", false)
    vehicle:setData("vehicle:desc", "")
    destroyElement(vehicle)
end)

addEvent("iyw_vehicles_exchange:insert_exchange", true)
addEventHandler("iyw_vehicles_exchange:insert_exchange", root, function(vehicle,text)
    cuboid[vehicle] = ColShape.Sphere(0, 0, 0, 3)
    cuboid[vehicle]:attach(vehicle, 0, 0, 0.50)
    vehicle:setData("vehicle:desc", "Model: "..(vehicle.name).."\nCena: "..text.." PLN\n\n\nPodejdz do tego pojazdu, aby uzyskac wiecej informacji!")
end)

addEventHandler("onColShapeHit", resourceRoot, function(player, dimension)
    if player.type == "player" and dimension then
        if not player.vehicle then
            if source == cub then return false end
            local vehicle = source:getElementsWithin("vehicle")
            if #vehicle < 1 or #vehicle > 1 then return false end

            local data = vehicle[1]:getData("vehicle:exchange")
            if not data then return false end
            
            local result = exports['marinarpg-db']:dbGet("SELECT marinarpg_pojazdy.*,marinarpg_lista_graczy.Login FROM marinarpg_pojazdy left join marinarpg_lista_graczy on marinarpg_lista_graczy.id=marinarpg_pojazdy.ownedPlayer WHERE marinarpg_pojazdy.id=?", tonumber(getElementData(vehicle[1], "vehicle:id")))
            local result2 = exports['marinarpg-db']:dbGet("SELECT marinarpg_pojazdy.firstowner,marinarpg_lista_graczy.Login FROM marinarpg_pojazdy left join marinarpg_lista_graczy on marinarpg_lista_graczy.id=marinarpg_pojazdy.firstowner WHERE marinarpg_pojazdy.id=?", tonumber(getElementData(vehicle[1], "vehicle:id")))
            local model = exports['marinarpg-db']:dbGet("SELECT id,model from marinarpg_pojazdy where model=? and id<=? order by id desc", result[1].model, result[1].id)
            triggerClientEvent(player, "iyw_vehicles_exchange:show_gui", player, vehicle[1], #model)
        end
    end
end)

addEventHandler("onColShapeHit", cub, function(player, dimension)
    if player.type == "player" and dimension then
        if player.vehicle then
            if player.vehicle:getData("vehicle:id") then
                if cuboid[player.vehicle] and isElement(cuboid[player.vehicle]) then cuboid[player.vehicle]:destroy() cuboid[player.vehicle] = false end
                player.vehicle:setData("vehicle:exchange", false)
                player.vehicle:setData("vehicle:desc", false)
            end
        end
    end
end)

addEventHandler("onColShapeLeave", cub, function(player, dimension)
    if player.type == "player" and dimension then
        if player.vehicle then
            if player.vehicle:getData("vehicle:id") then
                if cuboid[player.vehicle] and isElement(cuboid[player.vehicle]) then cuboid[player.vehicle]:destroy() cuboid[player.vehicle] = false end
                player.vehicle:setData("vehicle:exchange", false)
                player.vehicle:setData("vehicle:desc", false)
            end
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 10:57


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3348 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

killercycDDS, Tak wygl?da aktualny kod na twoim serwerze?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 10:59


killercycDDS

Migacz






Wiek: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

Respekt: 22

heros123345, tak od strony serwera

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-14, 11:02


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3348 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

killercycDDS, Spr?buj tak:


local cuboid = {}
local cub = ColShape.Cuboid(-2302.0866699219, -179.67449951172, 34.3203125, 32, 75.75, 4)
createBlip(-2286.65, -179.95, 35.32, 43, 25, 0, 0, 0, 0, 0, 175)

function RGBToHex(red, green, blue, alpha)
    if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end
    if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha) else return string.format("#%.2X%.2X%.2X", red, green, blue) end
end

addEvent("iyw_vehicles_exchange:buy_vehicle", true)
addEventHandler("iyw_vehicles_exchange:buy_vehicle", root, function(vehicle)
    local exchange = vehicle:getData("vehicle:exchange")
    if not exchange then return false end
    
    if source.money < tonumber(exchange.cost) then
        return triggerClientEvent(source, "onClientAddNotification", source, "Nie posiadasz tyle got?wki\nby m?c zakupi? ten pojazd! ("..tonumber(exchange.cost).."PLN)", "error")
    elseif source.name == exchange.owner then
        return triggerClientEvent(source, "onClientAddNotification", source, "Nie mo?esz kupi? swojego pojazdu!", "error")
    end
    
    vehicle:setData("vehicle:ownedPlayer", source:getData("player:sid"))
    warpPedIntoVehicle(source, vehicle, 0)
    source:takeMoney(exchange.cost)
    
    if getPlayerFromName(exchange.owner) and getPlayerFromName(exchange.owner):getData("player:logged") then
        triggerClientEvent(getPlayerFromName(exchange.owner), "onClientAddNotification", getPlayerFromName(exchange.owner), "U?ytkownik "..string.gsub(source.name, "#%x%x%x%x%x%x", "").."\nkupi? Tw?j pojazd, otrzymujesz "..exchange.cost.."PLN do portfela.", "success")
        triggerEvent("admin:addText", resourceRoot, RGBToHex(0, 200, 0)..("(GIE?DA) %s kupi? pojazd %s [ID: %s] od %s (%s PLN)"):format(source.name:gsub("#%x%x%x%x%x%x",""), vehicle:getName(), vehicle:getData("vehicle:id"), exchange.owner, exchange.cost, text)..RGBToHex(255, 255, 255), math.random(0,99))
        triggerClientEvent("onDebugMessage", resourceRoot, ("(GIE?DA) %s kupi? pojazd %s [ID: %s] od %s (%s PLN)"):format(source.name:gsub("#%x%x%x%x%x%x",""), vehicle:getName(), vehicle:getData("vehicle:id"), exchange.owner, exchange.cost, text), 5, "INNE")
        exports["marinarpg-db"]:dbSet("update marinarpg_lista_graczy set bank_money=bank_money+? where id=? limit 1",exchange.cost, exchange.data)
    else
        exports["marinarpg-db"]:dbSet("update marinarpg_lista_graczy set bank_money=bank_money+? where id=? limit 1",exchange.cost, exchange.data)
        triggerEvent("admin:addText", resourceRoot, RGBToHex(0, 200, 0)..("(GIE?DA) %s kupi? pojazd %s [ID: %s] od %s (%s PLN)"):format(source.name:gsub("#%x%x%x%x%x%x",""), vehicle:getName(), vehicle:getData("vehicle:id"), exchange.owner, exchange.cost, text)..RGBToHex(255, 255, 255), math.random(0,99))
        triggerClientEvent("onDebugMessage", resourceRoot, ("(GIE?DA) %s kupi? pojazd %s [ID: %s] od %s (%s PLN)"):format(source.name:gsub("#%x%x%x%x%x%x",""), vehicle:getName(), vehicle:getData("vehicle:id"), exchange.owner, exchange.cost, text), 5, "INNE")
    end
    exports["marinarpg-db"]:dbSet("UPDATE marinarpg_pojazdy SET ownedPlayer=?, ownedGroup=0, rent=0, parking=1 WHERE id=?", source:getData("player:sid"), vehicle:getData("vehicle:id"))
    exports["marinarpg-db"]:dbSet("UPDATE marinarpg_pojazdy SET czyj=? WHERE id=?", (source.name:gsub("#%x%x%x%x%x%x","")), vehicle:getData("vehicle:id"))
    if cuboid[vehicle] and isElement(cuboid[vehicle]) then cuboid[vehicle]:destroy() end
    vehicle:setData("vehicle:exchange", false)
    vehicle:setData("vehicle:desc", "")
    destroyElement(vehicle)
end)

addEvent("iyw_vehicles_exchange:insert_exchange", true)
addEventHandler("iyw_vehicles_exchange:insert_exchange", root, function(vehicle,text)
    cuboid[vehicle] = ColShape.Sphere(0, 0, 0, 3)
    cuboid[vehicle]:attach(vehicle, 0, 0, 0.50)
    vehicle:setData("vehicle:desc", "Model: "..(vehicle.name).."\nCena: "..text.." PLN\n\n\nPodejdz do tego pojazdu, aby uzyskac wiecej informacji!")
end)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
killercycDDS
Wysłany: 2019-04-14, 20:08


killercycDDS

Migacz






Wiek: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

Respekt: 22

heros123345, dzi?ki dzia?a po usuwa?e? pewne rzeczy ale doda?em i poprawnie ju? dzia?a

Postaw piwo autorowi tego posta
 

 
Tagi: ten :: sam :: nick
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