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

deadly atomowka






Wiek: 25
Na forum: 1254 dni
Posty: 63
Nick w MP: atomowka

Piwa: 995

Respekt: 50

Ostrzeżeń: 100%
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(source, paintJob)
        end
    end
end)

function switchPaintJob(el_data_key, new_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 v == source then
                        addVehiclePaintjob(v, tonumber(new_data))
                    end
                end
            end
        end
    end
end
addEventHandler("onClientElementDataChange", root, switchPaintJob)

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 i = 1, 15 do
        paintJobs[i] = dxCreateTexture("files/"..i..".png")
    end
end
loadPaintJobs()

function addVehiclePaintjob(vehicle, paintjobID)
    if vehicle and paintjobID then
        if getElementData(vehicle, "vehicle:id") then
                removeVehiclePaintjob(vehicle)
            
                vehiclesWithPaintjob[vehicle] = {}
                vehiclesWithPaintjob[vehicle][1] = dxCreateShader("files/textureChanger.fx", 0, 100, false, "vehicle")
            
            if vehiclesWithPaintjob[vehicle][1] and paintJobs[paintjobID] then
                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[vehicle] then
            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: 2846 dni
Posty: 297
Nick w MP: N0TH1NG

Piwa: 630

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

deadly atomowka






Wiek: 25
Na forum: 1254 dni
Posty: 63
Nick w MP: atomowka

Piwa: 995

Respekt: 50

Ostrzeżeń: 100%
"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 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