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

Wysłany: 2019-02-09, 13:57


AsterBonzo

Otwórz ogień






Wiek: 21
Na forum: 3109 dni
Posty: 187
Nick w MP: Hirahi

Piwa: 61

Respekt: 35,8

Witam robie sobie kryptonimy na pojazd sapd ale jest jaki? b??d gdy dodaje unit3 ?e jest z?e zamkni?cie eventu.
Oto kawa?ek kodu unit3

addEventHandler("onClientResourceStart", resourceRoot,function()
for i,v in ipairs(getElementsByType("vehicle")) do
if getElementData(v, "Unit3") then
shader = dxCreateShader('texreplace.fx')
shaderek = dxCreateShader('shader.fx')

local unit3 = getElementData(v, "Unit3")
if unit3 == 1 then

texture1 = dxCreateTexture('files/dach10.png')
dxSetShaderValue(shader,'gTexture',texture1)
engineApplyShaderToWorldTexture(shader,"224",v)
        textures = dxCreateTexture('files/03.png')
dxSetShaderValue(shaderek,'gTexture',textures)
engineApplyShaderToWorldTexture(shaderek,"03",v)
if unit3 == 2 then

texture2 = dxCreateTexture('files/dach11.png')
dxSetShaderValue(shader,'gTexture',texture2)
engineApplyShaderToWorldTexture(shader,"224",v)
        textures = dxCreateTexture('files/03.png')
dxSetShaderValue(shaderek,'gTexture',textures)
engineApplyShaderToWorldTexture(shaderek,"03",v)


end
end
end
end)

za pomoc piwko

Podpis

Pomagam jak potrafię :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-09, 14:42


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Mo?esz u?y? 'elseif' je?li sprawdzasz kilka razy to samo.

Gotowy kod:
addEventHandler("onClientResourceStart", resourceRoot,function()
    for i,v in ipairs(getElementsByType("vehicle")) do
        if getElementData(v, "Unit3") then
            shader = dxCreateShader('texreplace.fx')
            shaderek = dxCreateShader('shader.fx')
        
            local unit3 = getElementData(v, "Unit3")
            if unit3 == 1 then
                texture1 = dxCreateTexture('files/dach10.png')
                dxSetShaderValue(shader,'gTexture',texture1)
                engineApplyShaderToWorldTexture(shader,"224",v)
                textures = dxCreateTexture('files/03.png')
                dxSetShaderValue(shaderek,'gTexture',textures)
                engineApplyShaderToWorldTexture(shaderek,"03",v)
            elseif unit3 == 2 then  
                texture2 = dxCreateTexture('files/dach11.png')
                dxSetShaderValue(shader,'gTexture',texture2)
                engineApplyShaderToWorldTexture(shader,"224",v)
                textures = dxCreateTexture('files/03.png')
                dxSetShaderValue(shaderek,'gTexture',textures)
                engineApplyShaderToWorldTexture(shaderek,"03",v)
            end
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Tagi: kryptonimy :: sapd
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