Wysłany: 2023-07-17, 14:37
anonimovy
bombowiec
Wiek: 24 Na forum: 1113 dni Posty: 55
Nick w MP: atomowka
Piwa : 759
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
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
Dodaj?c kolejne paintjoby, zmieniaj warto?? w p?tli, bo aktualnie wykonuje iteracj? od 1 do 15
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
"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
Więcej szczegółów
Wystawiono 1 piw(a):borsuk
Tagi: nrpg_paintjobs
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: