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

Wysłany: 2023-10-07, 11:34


K4M7K







Wiek: 34
Na forum: 1326 dni
Posty: 9
Nick w MP: 7EVEN

Piwa: 6

Respekt: 50

OGolnie to chodzi o wairanty z tej paczki:https://gtao.pl/<font-colorff00ff>gm<-font>-directrpg-dafikosa-vt144472.htm mam skrypt odpowiadajcacy za menu wybierania wariantow itp ale nie wiem jak i gdzie dodaje sie nowe razem z tekstura auta pomoze ktos oto kod menu:
--[[ 
Skrypt wykonany dla serwera Navaxa RPG oraz DirectMTA
Autorzy GM: Dafikos / MateuszDafGames
Miłej Zabawy!
]]--

local warianty = {

    [477] = { -- ZR-350

        [0] = {"Mały spoiler", 20000},
        [1] = {"Duży spoiler", 30000},
        [2] = {"Body - Kit", 125000},
        [3] = {"Bez spoilera", 10000},

    },

    [429] = { -- Banshee 
        [0] = {"Bez dachu (Czarny)", 20000},
        [1] = {"Kabriolet bez dachu", 60000},
        [2] = {"Dach (Kolor)", 40000},
        [3] = {"Kabriolet z dachem", 60000},

    },

    [415] = { -- Cheetah 
        [0] = {"Światła Normal - Brak Spoilera", 20000},
        [1] = {"Światła Specjal - Brak Spoilera", 20000},

    },

    [480] = { -- Comet 
    [0] = {"Bez dachu", 20000},

    },

    [565] = { -- Flash 
        [0] = {"Lampy + Grill #1", 15000},
        [1] = {"Lampy + Grill #2", 15000},
        [2] = {"Lampy + Grill #3", 15000},
        [3] = {"Lampy + Grill #4", 15000},

        
    },

    [411] = { -- Infek 
        [0] = {"Dach - Brak lamp", 40000},
        [1] = {"Bez dachu - Brak lamp", 30000},

    },
    
    --[541] = { -- Bullet 
      --  [0] = {"Dach", 30000},
      --  [1] = {"Bez dachu", 20000},

    --},

    [559] = { -- Jester 
        [0] = {"Dach", 30000},
        [1] = {"Bez dachu", 20000},

        
    },

    [561] = { -- Stratum 
    [0] = {"Combi", 40000},
    [1] = {"Sedan", 30000},

        
    },

    [560] = { -- Sultan 
        [0] = {"Sedan", 50000},
        [1] = {"Sedan Body - Kit", 150000},
        [2] = {"Combi", 70000},
        [3] = {"Combi Body - Kit", 170000},
        [4] = {"Combi + Spoiler", 85000},
        [5] = {"Combi + Spoiler Body - Kit", 185000},
    },
        
    [506] = { -- Super GT 
        [0] = {"Lampy #1", 15000},
        [1] = {"Lampy #2", 15000},
        [2] = {"Lampy #3", 15000},

        
    },
            
    [555] = { -- Windsor 
    [0] = {"Kabriolet z dachem", 60000},
    [1] = {"Kabriolet bez dachu", 60000},

        
    },
    
    [402] = { -- Buffalo 
    [0] = {"Normal", 20000},
    [1] = {"Specjal", 40000},
    [2] = {"Sport", 60000},

    },

    [603] = { -- Phoenix 
        [0] = {"Lampy + Maska #1", 25000},
        [1] = {"Lampy + Maska #2", 25000},
        [2] = {"Lampy + Maska #3", 25000},

        
    },

    [475] = { -- Sabre 
        [0] = {"Normal", 10000},
        [1] = {"Sport", 350000},

        
    },
    
    [542] = { -- Clover 
        [0] = {"Normal", 10000},
        [1] = {"Sport", 350000},

        
    },

    [534] = { -- Remington
        [0] = {"Lampy #1", 15000},
        [1] = {"Lampy #2", 15000},

        
    },
    
    [567] = { -- Savanna 
        [0] = {"Lampy + Grill #1", 15000},
        [1] = {"Lampy + Grill #2", 15000},
        [2] = {"Lampy + Grill #3", 15000},
        [3] = {"Lampy + Grill #4", 15000},

        
    },
    
    [535] = { -- Slamvan 
        [0] = {"Bez dachu Specjalnego", 20000},
        [1] = {"Dach Specjalny", 40000},

    },
    
    [508] = { -- Journey 
        [0] = {"Specjal", 30000},
        [1] = {"Normal", 10000},

        
    },
        
    [500] = { -- Mesa 
        [0] = {"Dach", 20000},
        [1] = {"Off-Road", 30000},
        [2] = {"Bez dachu", 10000},
    },
        
    [495] = { -- Sandking 
        [0] = {"Specjal", 20000},
        [1] = {"Off-Road", 30000},
        [2] = {"Normal", 10000},

        
    },
            
    [490] = { -- Long 
    [0] = {"Normal", 20000},
    },
                
    [422] = { -- Bobcat 
    [0] = {"Off-Road #1", 2000},
    [1] = {"Off-Road #2", 3000},
    [2] = {"Off-Road #3", 4000},
    [3] = {"Normal", 1000},  

    },
        
    [482] = { -- Burrito 
        [0] = {"Normal", 10000},
        [1] = {"Specjal", 30000},

        
    },
                    
    [543] = { -- Sadler 
    [0] = {"Off-Road + Orurowanie", 5000},
    [1] = {"Zakryty Bagażnik + Orurowanie", 4000},  
    [2] = {"Zakryty Bagażnik", 2000},  
    [3] = {"Odkryty Bagażnik + Orurowanie", 3000},  
    [4] = {"Odkryty Bagażnik", 1000},  
    },
            
    [478] = { -- Walton 
        [0] = {"Z Klapą Bagażnika", 3000},
        [1] = {"Obudowa Bagażnika", 2000},
        [2] = {"Bez Klapy Bagażnika", 1000},
    },
                
    [554] = { -- Yosemite 
    [0] = {"Normal", 10000},
    [1] = {"Off-Road #1", 20000},
    [2] = {"Off-Road #2", 30000},
    },
                    
    [579] = { -- Huntley 
    [0] = {"Normal", 20000},
    },
                
    [400] = { -- Landstalker 
    [0] = {"Normal", 10000},
    [1] = {"Specjal", 20000},
    [2] = {"Bez Klapy Bagażnika + Orurowanie", 30000},
    [3] = {"Dodatki #1", 50000},
    [4] = {"Off-Road", 40000},
    [5] = {"Dodatki #2", 50000},
    },
    
    [404] = { -- Perennial 
    [0] = {"Combi", 2000},
    [1] = {"Combi", 2000},
    [2] = {"Sedan", 4000},
        
    },

                        
    [489] = { -- Rancher 
    [0] = {"Normal", 20000},
    },
    
   -- [496] = { -- Blista Compact     
     --   [0] = {"Dach", 5000},
       -- [1] = {"Szyberdach", 8000},

    --},
    
    [589] = { -- Club 
        [0] = {"Normal", 10000},
        [1] = {"Specjal GTI", 20000},
  
    },
            
    [587] = { -- Euros 
        [0] = {"Dach", 10000},
        [1] = {"Szyberdach", 20000},

    },
    
    [533] = { -- Feltzer 
        [0] = {"Kabriolet bez dachu", 40000},
        [1] = {"Dach", 20000},
        [2] = {"Kabriolet z dachem", 40000},
    },
                
    [526] = { -- Fortune
        [0] = {"Lampy #1", 5000},
        [1] = {"Lampy #2", 8000},

        
    },
                
    [410] = { -- Manana 
    [0] = {"Dach", 1000},
    [1] = {"Kabriolet z dachem", 3250},
    [2] = {"Kabriolet bez dachu", 3250},
    [3] = {"Hatchback", 4500},
        
    },
                    
    [600] = { -- Picador
        [0] = {"Custom", 3000},
        [1] = {"Specjal", 4000},
        [2] = {"Normal", 2000},
        
    },
        
    [436] = { -- Previon 
        [0] = {"Normal", 2000},
        [1] = {"Specjal", 8000},
  
    },
                    
    [439] = { -- Stallion 
    [0] = {"Dach", 5000},
    [1] = {"Kabriolet z dachem", 7500},
    [2] = {"Kabriolet bez dachu", 7500},

        
    },
            
    --[507] = { -- Elegant 
       -- [0] = {"Specjal", 10000},
       -- [1] = {"Spoiler", 15000},
       -- [2] = {"Normal", 5000},
  
    --},
        
    [585] = { -- Emperor 
        [0] = {"Lampy #1", 2500},
        [1] = {"Lampy #2", 2500},
        [2] = {"Lampy #3", 2500},
        [3] = {"Lampy #4", 2500},

        
    },
    
    [426] = { -- Premier 
        [0] = {"Sedan", 20000},
       -- [1] = {"Combi", 40000},

        
    },
         
    [445] = { -- Admiral 
    [0] = {"Sedan", 30000},
    [1] = {"Combi", 40000},

    
},

    [405] = { -- Sentinel 
        [0] = {"Sedan", 30000},
        [1] = {"Combi", 40000},

        
    },
        
    [421] = { -- Washington 
        [0] = {"Lampy + Grill #1", 2500},
        [1] = {"Lampy + Grill #2", 2500},

        
    },
    
    [614] = { -- Deluxo

        [0] = {"Spoiler", 30000},
        [1] = {"Brak Spoilera", 10000},

    },
        
    [615] = { -- Zion 
    [0] = {"Specjal", 10000},
    [1] = {"Normal", 5000},
  
    },
                
    [619] = { -- kurumaGT 
        [0] = {"Dach", 10000},
        [1] = {"Szyberdach", 20000},

    },
                    
    [622] = { -- Coquete 
        [0] = {"Kabriolet", 20000},

    },

    [516] = { -- Nebula 
    [0] = {"Combi", 20000},
    [1] = {"Sedan", 30000},

    },
         
    [540] = { -- Vicek
    [0] = {"Sedan", 20000},
    [1] = {"Combi", 30000},

},
        
[562] = { -- Elegy
[0] = {"Lampy #1", 25000},
[1] = {"Lampy #2", 35000},


},
    
[418] = { -- Klocek 
[0] = {"Normal", 2000},
[1] = {"Specjal", 4000},

},

[479] = { -- Regina 
[0] = {"Combi", 4000},
[1] = {"Sedan", 2000},

    
},
    
[527] = { -- Cadrona 
[0] = {"Dach", 4000},
[1] = {"Kabriolet bez dachu", 5000},
[2] = {"Kabriolet z dachem", 5000},
},

}

local save = {

    wariant  = {arg1 = nil, arg2 = nil}

}

local e1 = false

local sx, sy = guiGetScreenSize()
local zoom = exports["borsuk-gui"]:getZoom()
local font1 = exports["borsuk-gui"]:getFont("Lato-Regular", 13/zoom)
local font2 = exports["borsuk-gui"]:getFont("Lato-Regular", 11/zoom)
local font3 = exports["borsuk-gui"]:getFont("Lato-Bold", 13/zoom)

local marker = createMarker(-2052.61, 171.57, 27.70-1, "cylinder", 3, 0, 170, 255)
setElementData(marker, "marker:title", "Tuning")
setElementData(marker, "marker:desc", "Zmiana wariantu")

function dxDrawShadowText(text, x, y, w, h, color, ...)
    dxDrawText(text, x + 2, y + 2, w + 2, h + 2, tocolor(0, 0, 0, 155), ...)
    dxDrawText(text, x, y, w, h, color, ...)
end

local _getElementModel = getElementModel
function getElementModel(veh)
    return (getElementData(veh, "vehicle:model") or _getElementModel(veh))
end

function renderVariantGUI()
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    local model = getElementModel(veh)
    local var1, var2 = getVehicleVariant(veh)

    dxDrawRoundedRectangle(sx/2 - 190/zoom, sy - 194/zoom, 380/zoom, 120/zoom, 15/zoom, tocolor(25,25,25))

    if not warianty[model] then
        dxDrawText("Brak  wariantów  dla  tego  pojazdu", sx/2, sy - 170/zoom, sx/2, sy - 100/zoom, white, 1, font1, "center", "center")
    else
        local c1 = (warianty[model].current1 or 0)
        dxDrawText("< Wariant: " .. warianty[model][c1][1].." >", sx/2, sy - 175/zoom, sx/2, sy - 130/zoom, white, 1, font1, "center", "top")
        dxDrawText("Cena zmiany wariantu: " ..warianty[model][c1][2].." PLN", sx/2, sy - 200/zoom, sx/2, sy - 110/zoom, tocolor(55, 200, 55), 1, font2, "center", "bottom")
        dxDrawText("Aby zakupić wariant kliknij #0091ffK", sx/2, sy - 110/zoom, sx/2, sy - 90/zoom, tocolor(200, 200, 200), 1, font2, "center", "top", false, false, false, true)
    end
end

function updateVariant()
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end

    local model = getElementModel(veh)
    local c1 = (warianty[model].current1 or 0)
    setElementData(veh, "vehicle:var", {c1, c2}, false)
    setVehicleVariant(veh, c1, c1)
end

function leftKey()
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    local model = getElementModel(veh)

    if (warianty[model].current0 or 1) == 1 then
        warianty[model].current1 = math.max((warianty[model].current1 or 0) - 1, 0)
    else
        warianty[model].current2 = math.max((warianty[model].current2 or 0) - 1, 0)
    end

    updateVariant()
end

function rightKey()
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    local model = getElementModel(veh)

    if (warianty[model].current0 or 1) == 1 then
        warianty[model].current1 = math.min((warianty[model].current1 or 0) + 1, #warianty[model])
    else
        warianty[model].current2 = math.min((warianty[model].current2 or 0) + 1, #warianty[model])
    end

    updateVariant()
end

function buyVariant()
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    local model = getElementModel(veh)
    local var1, var2 = getVehicleVariant(veh)
    local c1 = (warianty[model].current1 or 0)

    if getPlayerMoney(localPlayer) >= warianty[model][c1][2] then
        save.wariant = {arg1 = c1, arg2 = c1}
        triggerServerEvent("changeVariant", localPlayer, localPlayer, veh, c1, warianty[model][c1][1], warianty[model][c1][2])
    else
        exports["noobisty-notyfikacje"]:createNotification("Zmiana wariantu", "Nie posiadasz tyle pieniędzy", {200, 50, 50}, "sighter")
    end
end

function showVariantGUI()
    local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    if getElementData(localPlayer, "player:sid") ~= getElementData(veh, "vehicle:ownedPlayer") then return end
    setElementVelocity(veh, 0, 0, 0)
    addEventHandler("onClientRender", root, renderVariantGUI)
    local model = getElementModel(veh)

    local var1, var2 = getVehicleVariant(veh)
    save.wariant = {arg1 = var1, arg2 = var2}

    if warianty[model] then
        bindKey("arrow_l", "down", leftKey)
        bindKey("arrow_r", "down", rightKey)
        bindKey("k", "down", buyVariant)
    end
end

function hideVariantGUI()
    local veh = getPedOccupiedVehicle(localPlayer)
    removeEventHandler("onClientRender", root, renderVariantGUI)

    unbindKey("arrow_l", "down", leftKey)
    unbindKey("arrow_r", "down", rightKey)
    unbindKey("k", "down", buyVariant)
    if not veh then return end

    if save.wariant.arg1 ~= nil then
        local model = getElementModel(veh)
        setElementData(veh, "vehicle:var", {save.wariant.arg1, save.wariant.arg2}, false)
        setVehicleVariant(veh, save.wariant.arg1, save.wariant.arg2)
    end
end

addEventHandler("onClientMarkerHit", marker, function(plr)
    if plr ~= localPlayer then return end

    showVariantGUI()
end)

addEventHandler("onClientMarkerLeave", marker, function(plr)
    if plr ~= localPlayer then return end

    hideVariantGUI()
end)

function onQuitGame()
    if source == localPlayer then
        setElementData(getPedOccupiedVehicle(localPlayer), "vehicle:var", {save.wariant.arg1, save.wariant.arg2}, false)
        setVehicleVariant(getPedOccupiedVehicle(localPlayer), save.wariant.arg1, save.wariant.arg2)
    end
end
addEventHandler( "onClientPlayerQuit", root, onQuitGame)

function dxDrawRoundedRectangle(x, y, width, height, radius, color, postGUI, subPixelPositioning)
    dxDrawRectangle(x+radius, y+radius, width-(radius*2), height-(radius*2), color, postGUI, subPixelPositioning)
    dxDrawCircle(x+radius, y+radius, radius, 180, 270, color, color, 16, 1, postGUI)
    dxDrawCircle(x+radius, (y+height)-radius, radius, 90, 180, color, color, 16, 1, postGUI)
    dxDrawCircle((x+width)-radius, (y+height)-radius, radius, 0, 90, color, color, 16, 1, postGUI)
    dxDrawCircle((x+width)-radius, y+radius, radius, 270, 360, color, color, 16, 1, postGUI)
    dxDrawRectangle(x, y+radius, radius, height-(radius*2), color, postGUI, subPixelPositioning)
    dxDrawRectangle(x+radius, y+height-radius, width-(radius*2), radius, color, postGUI, subPixelPositioning)
    dxDrawRectangle(x+width-radius, y+radius, radius, height-(radius*2), color, postGUI, subPixelPositioning)
    dxDrawRectangle(x+radius, y, width-(radius*2), radius, color, postGUI, subPixelPositioning)
end


kod po stronie servera:
--[[ 
Skrypt wykonany dla serwera Navaxa RPG oraz DirectMTA
Autorzy GM: Dafikos / MateuszDafGames
Miłej Zabawy!
]]--

addEvent("changeVariant", true)
addEventHandler("changeVariant", root, function(plr, veh, war, name, cost)
    if veh then
        if getElementData(veh, "vehicle:id") then
            exports["noobisty-notyfikacje"]:createNotification(plr, "Zmiana wariantu", "Zakupiono wariant do pojazdu ("..name..") za cenę "..cost.." PLN", {50, 200, 50}, "sight")
            setElementData(veh, "vehicle:var", {war, war})
            setVehicleVariant(veh, war, war)
            exports['pystories-db']:dbSet("UPDATE pystories_vehicles set wariant = ? where id = ?", war..", "..war, getElementData(veh, "vehicle:id"))

            takePlayerMoney(plr, cost)
        end
    end
end)


za pomoc daje zimne piwko :piwo: :piwo:

Ostatnio zmieniony przez rxkrxd 2023-10-07, 11:38, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-10-08, 17:34


MeeShuffle

Programista/Grafik






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

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Nie widzę w tym kodzie możliwości dodania własnego wariantu, bazuje on tylko na defaultowych GTASA

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: jak :: dodac :: nowe :: warianty
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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