Jayceon

Members
  • Content Count

    87
  • Joined

  • Last visited

Everything posted by Jayceon

  1. Jayceon

    Custom wheel

    Thanks the reply, i'm waiting your example.
  2. Jayceon

    Custom wheel

    Hello everyone! I tried to make custom wheels to vehicles (like tuning element) but i have some problems with code. When the wheel camber angle is not default, the wheel get not good rotations. local createdCustomWheels = {} bindKey("f2", "down", function() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then addCustomWheel(vehicle, 1075, "front") end end ) addEventHandler("onClientPreRender", root, function() for vehicle, value in pairs(createdCustomWheels) do if vehicle and isElement(vehicle) and isElementStreamedIn(vehicle) then local vehicleX, vehicleY, vehicleZ = getElementPosition(vehicle) if value["wheel_lf_dummy"] then local componentX, componentY, componentZ = getVehicleComponentPosition(vehicle, "wheel_lf_dummy") local componentRX, componentRY, componentRZ = getVehicleComponentRotation(vehicle, "wheel_lf_dummy") attachElements(value["wheel_lf_dummy"], vehicle, componentX, componentY, componentZ, componentRX, -15 + componentRY, componentRZ) end if value["wheel_rf_dummy"] then local componentX, componentY, componentZ = getVehicleComponentPosition(vehicle, "wheel_rf_dummy") local componentRX, componentRY, componentRZ = getVehicleComponentRotation(vehicle, "wheel_rf_dummy") attachElements(value["wheel_rf_dummy"], vehicle, componentX, componentY, componentZ, componentRX, -15 + componentRY, componentRZ) end end end end ) function addCustomWheel(vehicle, wheelId, side) if vehicle and wheelId and side then local vehicleX, vehicleY, vehicleZ = getElementPosition(vehicle) if side == "front" then local lfX, lfY, lfZ = getVehicleComponentPosition(vehicle, "wheel_lf_dummy") local rfX, rfY, rfZ = getVehicleComponentPosition(vehicle, "wheel_rf_dummy") setVehicleComponentVisible(vehicle, "wheel_lf_dummy", false) setVehicleComponentVisible(vehicle, "wheel_rf_dummy", false) createdCustomWheels[vehicle] = {} createdCustomWheels[vehicle]["wheel_lf_dummy"] = createObject(wheelId, vehicleX, vehicleY, vehicleZ) createdCustomWheels[vehicle]["wheel_rf_dummy"] = createObject(wheelId, vehicleX, vehicleY, vehicleZ) setElementCollidableWith(createdCustomWheels[vehicle]["wheel_lf_dummy"], vehicle, false) setElementCollidableWith(createdCustomWheels[vehicle]["wheel_rf_dummy"], vehicle, false) setObjectScale(createdCustomWheels[vehicle]["wheel_lf_dummy"], 0.7) setObjectScale(createdCustomWheels[vehicle]["wheel_rf_dummy"], 0.7) attachElements(createdCustomWheels[vehicle]["wheel_lf_dummy"], vehicle, lfX, lfY, lfZ, 0, 0, 0) attachElements(createdCustomWheels[vehicle]["wheel_rf_dummy"], vehicle, rfX, rfY, rfZ, 0, 0, 0) end end end
  3. This interested me. And how calculate this with processLineOfSight?
  4. Hello. Please add compiler to meta.xml in later updates. <script src="sourceC.lua" extra_obfuscation="2" /> <!-- 0 - None | 1 = Some | 2 = More (From 1.5.2-9.07903) --> And when player join to the server and meta try to load (and extra_obfuscation is not nil) automatic compile the selected files. Thanks to read my idea.
  5. Nincs mit. (Név + profilodon írja)
  6. http://fontawesome.io/cheatsheet/ Innen magát az ikont másold ki és ha beillesztetted oda ahova szeretnéd egy üres négyzetnek kell lennie. Esetleg, hogy tudd milyen ikont használsz, csinálj egy táblát. local icons = { ["automobile"] = "", ["trash"] = "", } --dxDrawText(icons["automobile"], ...)
  7. shader fx: technique tintedWindow { pass P0 { DepthBias = -0.0000; AlphaBlendEnable = TRUE; SrcBlend = SRCALPHA; DestBlend = INVSRCALPHA; } } technique fallback { pass P0 { } } LUA: local tintShaders = {} local elementShaders = {} local availableTintedWindows = { [405] = "@hite", } addEventHandler("onClientResourceStart", resourceRoot, function() for _, vehicle in ipairs(getElementsByType("vehicle", root, true)) do local vehicleHaveTintedWindow = getElementData(vehicle, "tuning.tintedWindow") or 0 if vehicleHaveTintedWindow ~= 0 then setVehicleWindowType(vehicle) end end end) addEventHandler("onClientElementStreamIn", root, function() if getElementType(source) == "vehicle" then local vehicleHaveTintedWindow = getElementData(source, "tuning.tintedWindow") or 0 if vehicleHaveTintedWindow ~= 0 then setVehicleWindowType(source) end end end) addEventHandler("onClientElementDestroy", root, function() if getElementType(source) == "vehicle" then destroyTintedWindowShader(source) end end) addEventHandler("onClientElementStreamOut", root, function() if getElementType(source) == "vehicle" then destroyTintedWindowShader(source) end end) addEvent("tuning->TintedWindow", true) function setVehicleWindowType(vehicle, adding) local vehicleModel = getElementModel(vehicle) local windowTexture = availableTintedWindows[vehicleModel] if adding == 0 then destroyTintedWindowShader(vehicle) else if windowTexture then applyTintedWindowShader(windowTexture, 100, vehicle) else destroyTintedWindowShader(vehicle) end end end addEventHandler("tuning->TintedWindow", root, setVehicleWindowType) function destroyTintedWindowShader(element) if elementShaders[element] then destroyElement(elementShaders[element][1][1]) elementShaders[element] = nil end end function applyTintedWindowShader(texture, distance, element) if element then destroyTintedWindowShader(element) end local this = #tintShaders + 1 tintShaders[this] = {} tintShaders[this][1] = dxCreateShader("files/textures/tintedWindow.fx", 0, distance, true) if not tintShaders[this][1] then tintShaders[this] = nil return end if element then if not elementShaders[element] then elementShaders[element] = {tintShaders[this], texture} end end if tintShaders[this][1] and tintShaders[this][2] then engineApplyShaderToWorldTexture(tintShaders[this][1], texture, element) end end
  8. Original: https://community.multitheftauto.com/in ... s&id=13508 Stolen: https://community.mtasa.com/index.php?p ... s&id=13558 DONE