Szerző Téma: paintjob segítség kérés  (Megtekintve 1320 alkalommal)

paintjob segítség kérés
« Dátum: 2016. október 19. - 13:40:23 »
0 Show voters
Sziasztok találtam egy paintjob scriptet de ez a script csak sima alap gtas kocsira rakja rá a PJ-t hogy tudnám megcsinálni hogy ne arra hanem modolt kocsira is tegye?
Kód SourceC
local vehiclesWithPaintjob = {}
addCommandHandler(\"pj\", function(command, id)
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
if id and tonumber(id) then
   if getAvailablePaintjobs(getElementModel(vehicle))[tonumber(id)] or tonumber(id) == 0 then
      triggerServerEvent(\"paintjob->Manage\", localPlayer, vehicle, tonumber(id)) -- add paintjob, when id is 0 => remove paintjob
      setElementData(vehicle, \"vehicle.paintjob\", tonumber(id))
   else
      outputChatBox(\"#d75959[Paintjob]: #ffffffThis paintjob doesn\'t exists!\", 255, 255, 255, true)
   end
else
   triggerServerEvent(\"paintjob->Manage\", localPlayer, vehicle, 0) -- remove paintjob
   setElementData(vehicle, \"vehicle.paintjob\", 0)
end
end
end)
addEventHandler(\"onClientResourceStart\", resourceRoot, function()
for _, vehicle in ipairs(getElementsByType(\"vehicle\", root, true)) do
local isVehicleHavePaintjob = getElementData(vehicle, \"vehicle.paintjob\") or 0
if isVehicleHavePaintjob ~= 0 then
   addVehiclePaintjob(vehicle, isVehicleHavePaintjob)
end
end
end)
addEvent(\"paintjob->TryToAddToVehicle\", true)
addEventHandler(\"paintjob->TryToAddToVehicle\", root, function(vehicle, paintjobID)
if vehicle then
if paintjobID and paintjobID ~= 0 then
   addVehiclePaintjob(vehicle, paintjobID)
else
   removeVehiclePaintjob(vehicle)
end
end
end)
addEventHandler(\"onClientElementStreamIn\", root, function()
if getElementType(source) == \"vehicle\" then
local isVehicleHavePaintjob = getElementData(source, \"vehicle.paintjob\") or 0
if isVehicleHavePaintjob ~= 0 then
   addVehiclePaintjob(source, isVehicleHavePaintjob)
end
end
end)
addEventHandler(\"onClientElementStreamOut\", root, function()
if getElementType(source) == \"vehicle\" then
local isVehicleHavePaintjob = getElementData(source, \"vehicle.paintjob\") or 0
if isVehicleHavePaintjob ~= 0 then
   removeVehiclePaintjob(source)
end
end
end)
addEventHandler(\"onClientElementDestroy\", root, function()
if getElementType(source) == \"vehicle\" then
local isVehicleHavePaintjob = getElementData(source, \"vehicle.paintjob\") or 0
if isVehicleHavePaintjob ~= 0 then
   removeVehiclePaintjob(source)
end
end
end)
function addVehiclePaintjob(vehicle, paintjobID)
if vehicle and paintjobID then
local availablePaintjobs = getAvailablePaintjobs(getElementModel(vehicle))
if availablePaintjobs[paintjobID] then
   removeVehiclePaintjob(vehicle)
   vehiclesWithPaintjob[vehicle] = {}
   vehiclesWithPaintjob[vehicle][1] = dxCreateShader(\"files/textureChanger.fx\", 0, 100, false, \"vehicle\")
   vehiclesWithPaintjob[vehicle][2] = dxCreateTexture(\"files/paintjobs/\" .. availablePaintjobs[paintjobID][2])
   if vehiclesWithPaintjob[vehicle][1] and vehiclesWithPaintjob[vehicle][2] then
      dxSetShaderValue(vehiclesWithPaintjob[vehicle][1], \"TEXTURE\", vehiclesWithPaintjob[vehicle][2])
      engineApplyShaderToWorldTexture(vehiclesWithPaintjob[vehicle][1], availablePaintjobs[paintjobID][1], vehicle)
   else
      outputDebugString(\"[PAINTJOB]: Shader or Texture create failed!\", 3)
   end
end
end
end
function removeVehiclePaintjob(vehicle)
if vehicle then
if vehiclesWithPaintjob[vehicle] then
   destroyElement(vehiclesWithPaintjob[vehicle][1])
   destroyElement(vehiclesWithPaintjob[vehicle][2])
   vehiclesWithPaintjob[vehicle] = nil
end
end
end

 
Kód SourceG
local availablePaintjobs = {
[517] = {
{\"*vehiclegrunge256*\", \"majestic/1.jpg\"},
{\"*vehiclegrunge256*\", \"majestic/2.jpg\"},
},
[579] = {
{\"*vehiclegrunge256*\", \"huntley/1.png\"},
{\"*vehiclegrunge256*\", \"huntley/2.png\"},
},
}
function getAvailablePaintjobs(model)
if model then
if availablePaintjobs[model] then
   return availablePaintjobs[model]
end
end
return nil
end

 
Kód SourceS
addEvent(\"paintjob->Manage\", true)
addEventHandler(\"paintjob->Manage\", root, function(vehicle, paintjobID)
if vehicle and paintjobID then
triggerClientEvent(root, \"paintjob->TryToAddToVehicle\", root, vehicle, paintjobID)
end
end)

paintjob segítség kérés
« Válasz #1 Dátum: 2016. október 19. - 14:12:19 »
0 Show voters
Mivel az alap kocsi TXD-t akarja változtatni.
E: Gondolom én.

paintjob segítség kérés
« Válasz #2 Dátum: 2016. október 19. - 15:26:00 »
0 Show voters
Idézetet írta: geri66 date=1476877223\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"63383\" data-ipsquote-contentclass=\"forums_Topic
Kód SourceG
local availablePaintjobs = {
[517] = {
{\"*vehiclegrunge256*\", \"majestic/1.jpg\"},
{\"*vehiclegrunge256*\", \"majestic/2.jpg\"},
},
[579] = {
{\"*vehiclegrunge256*\", \"huntley/1.png\"},
{\"*vehiclegrunge256*\", \"huntley/2.png\"},
},
}

 

*vehiclegrunge256* -> Ezt kell átírnod a kocsi textúrájának a nevére.

paintjob segítség kérés
« Válasz #3 Dátum: 2016. október 25. - 17:24:03 »
0 Show voters
Ezt letöltöd, majd megnézed a kocsi textúrának a nevét és beirod a vehiclegrounge..... helyére
LINK: http://nightly.mtasa.com/files/shaders/shader_tex_names.zip

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal