-
Posts
91 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Jayceon
-
Hello. Today i started the MTA and the MTA automatically download new update before start. In the menu and at the top of the screen appeared a red stripe with the following message: Your operating system is outdated and prone to security vulnerabilities. You should consider updating as soon as possible. I'm using Windows 10 Pro with a newest update. Thanks the replies, sorry my english.
-
Hello. I have a custom F11 map, but i has some problem with "waypoint" create. When i'm click on map, the waypoint makes not in the cursor position, the waypoint has a small offset (left, right, up, down) and this is not good. local screenX, screenY = guiGetScreenSize() local mapTextureSize = 3072 local bigmapMapUnit = mapTextureSize / 6000 local bigmapWidth = screenX - 60 local bigmapHeight = screenY - 60 local bigmapX = 30 local bigmapY = 30 local bigmapCurrentZoom = 1.5 local playerX, playerY, playerZ = 0, 0, 0 -- automatic updating in render function getWorldFromMapPosition(mapX, mapY) -- This function dont work correctly (mapX, mapY = cursor relative X,Y) local worldX = playerX + ((mapX * (((bigmapX + bigmapWidth) / bigmapCurrentZoom) * 2)) - ((bigmapX + bigmapWidth) / bigmapCurrentZoom)) local worldY = playerY - ((mapY * (((bigmapY + bigmapHeight) / bigmapCurrentZoom) * 2)) - ((bigmapY + bigmapHeight) / bigmapCurrentZoom)) return worldX, worldY end function getMapFromWorldPosition(worldX, worldY) local mapX = (bigmapX + bigmapWidth / 2) + ((worldX - playerX) * bigmapCurrentZoom) * bigmapMapUnit local mapY = (bigmapY + bigmapHeight / 2) - ((worldY - playerY) * bigmapCurrentZoom) * bigmapMapUnit return mapX, mapY end Thanks the replies.
-
dxDrawText or dxDrawRectangle all screen resolutions problem
Jayceon replied to longsnake34's topic in Scripting
local screenX, screenY = guiGetScreenSize() local responsiveMultiplier = (screenX + 2048) / (2048 * 2) local testRectangleWidth = 256 * responsiveMultiplier local testRectangleHeight = 128 * responsiveMultiplier local testFont = dxCreateFont("fontPath.ttf", 14 * responsiveMultiplier, false, "antialiased") local marginOffset = 10 local rightSideOfTheScreen = (screenX - marginOffset) - testRectangleWidth local centerTheBoxY = (screenY - testRectangleHeight) / 2 dxDrawRectangle(rightSideOfTheScreen, centerTheBoxY, testRectangleWidth, testRectangleHeight, tocolor(0, 0, 0, 150)) -- on dxDrawText scale is 1.0 or smaller when you have custom font, responsiveMultiplier only using it in dxCreateFont -
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
-
This interested me. And how calculate this with processLineOfSight?
- 14 replies
-
- getelementboundingbox
- vehicle
-
(and 1 more)
Tagged with:
-
Thanks your reply.
- 4 replies
-
- extra
- obfucation
-
(and 1 more)
Tagged with:
-
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.
- 4 replies
-
- extra
- obfucation
-
(and 1 more)
Tagged with:
-
Nincs mit. (Név + profilodon írja)
-
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"], ...)
-
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
-
Original: https://community.multitheftauto.com/in ... s&id=13508 Stolen: https://community.multitheftauto.com/index.php?p ... s&id=13558 DONE