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

Wysłany: 2023-07-17, 14:37


anonimovy

bombowiec






Wiek: 24
Na forum: 1113 dni
Posty: 55
Nick w MP: atomowka

Piwa: 759

Respekt: 50

Ostrzeżeń: 20%
Witam potrzebuje pomocy by dodac wiecej paintjob?w ni? 12. Mam dodanych ich wiecej i w meta.xml r?wnie? ale wciaz gdy chce nadac paintjoba to pisze abym wybral paintjoba od 1-12 a mam ich 16...
Kt?re mam zmienic w skrypcie?

c.lua :
local vehiclesWithPaintjob = {}

addEventHandler("onClientElementStreamIn"root, function()
    if getElementType(source) == "vehicle" then
        local paintJob getElementData(source"vehicle:paintjob")
        
        if paintJob ~= 0 then
            addVehiclePaintjob(sourcepaintJob)
        end
    end
end)

function switchPaintJob(el_data_keynew_data)
    if (getElementType(source) == "vehicle"then
        if (el_data_key == "vehicle:paintjob"then
            if new_data ~= false then
                for i,v in ipairs(getElementsByType("vehicle")) do
                    if == source then
                        addVehiclePaintjob(vtonumber(new_data))
                    end
                end
            end
        end
    end
end
addEventHandler("onClientElementDataChange"rootswitchPaintJob)

addEventHandler("onClientElementStreamOut"root, function()
    if getElementType(source) == "vehicle" then
        if getElementData(source"vehicle:id"then
            if getElementData(source"vehicle:paintjob"then
                removeVehiclePaintjob(source)
            end
        end
    end
end)

addEventHandler("onClientElementDestroy"root, function()
    if getElementType(source) == "vehicle" then
        if getElementData(source"vehicle:id"then
            local isVehicleHavePaintjob getElementData(source"vehicle:paintjob")
        
            if isVehicleHavePaintjob ~= 0 then
                removeVehiclePaintjob(source)
            end
        end
    end
end)

paintJobs = {}

function loadPaintJobs()
    for 115 do
        paintJobs[i] = dxCreateTexture("files/"..i..".png")
    end
end
loadPaintJobs()

function addVehiclePaintjob(vehiclepaintjobID)
    if vehicle and paintjobID then
        if getElementData(vehicle"vehicle:id"then
                removeVehiclePaintjob(vehicle)
            
                vehiclesWithPaintjob[vehicle] = {}
                vehiclesWithPaintjob[vehicle][1] = dxCreateShader("files/textureChanger.fx"0100false"vehicle")
            
            if vehiclesWithPaintjob[vehicle][1] and paintJobs[paintjobIDthen
                dxSetShaderValue(vehiclesWithPaintjob[vehicle][1], "TEXTURE"paintJobs[paintjobID])
                engineApplyShaderToWorldTexture(vehiclesWithPaintjob[vehicle][1], "*vehiclegrunge256*"vehicle)
                engineApplyShaderToWorldTexture vehiclesWithPaintjob[vehicle][1], "?emap*"vehicle)
            end
        end
    end
end

function removeVehiclePaintjob(vehicle)
    if vehicle then
        if vehiclesWithPaintjob[vehiclethen
            local paintjobID getElementData(vehicle"vehicle:paintjob")
            if not paintjobID then return end
            destroyElement(vehiclesWithPaintjob[vehicle][1])
            vehiclesWithPaintjob[vehicle] = nil
        end
    end
end


Ostatnio zmieniony przez N0TH1NG 2023-07-17, 14:42, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-07-17, 14:54


N0TH1NG

Mod-Team






Wiek: 20
Na forum: 2705 dni
Posty: 286
Nick w MP: N0TH1NG

Piwa: 626

Respekt: 830
Respekt: 830Respekt: 830

Dodaj?c kolejne paintjoby, zmieniaj warto?? w p?tli, bo aktualnie wykonuje iteracj? od 1 do 15

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-07-18, 00:08


anonimovy

bombowiec






Wiek: 24
Na forum: 1113 dni
Posty: 55
Nick w MP: atomowka

Piwa: 759

Respekt: 50

Ostrzeżeń: 20%
"N0TH1NG" napisał/a:

Dodaj?c kolejne paintjoby, zmieniaj warto?? w p?tli, bo aktualnie wykonuje iteracj? od 1 do 15


Tylko ?e i tak nie dzia?? to bo mam paintjoby od 1-12 taka notyfikacja wyskakuje nawet po restarcie serwera

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: nrpg_paintjobs
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » nrpg_paintjobs 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