Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. Ah oke, well you need a public web folder in that case. But keep in mind that a .map file is XML. And to read XML you need a file in order to use this function: https://wiki.multitheftauto.com/wiki/XmlLoadFile Don't make it harder than it is already. @N3xT The most secure thing you can do is to read the map file serverside. Convert it to a table format. Send it to clientside with triggerClientEvent and do what you want to do.
  2. Why don't you use this instead? https://wiki.multitheftauto.com/wiki/DownloadFile fetchRemote has afaik not access to those files inside of a resource. Public web folder is required!
  3. IIYAMA

    Table..

    @SSKE Other methods next to table.insert to insert in to a table: -------------------------------------- -- Using the table more as an array -- -- manual insert zones[1] = "value" zones[2] = "value" zones[3] = "value" zones[4] = "value" -- Auto insert at the end. Does almost the same as table.insert, it just can't pushing items (from the first index) and it is much faster. zones[#zones + 1] = "value" -- #zones -- table length! -- #zones + 1 = new free slot! --------------------------------------- -- Using the table more as an object -- -- Dot notation zones.header = "value" zones.bodyText = "value" zones.subText = "value" -- The same without dot notation zones["header"] = "value" zones["bodyText"] = "value" zones["subText"] = "value" -- Using other values as index (yes no limits) zones[{}] = "value" -- table zones[2425] = "value" -- number zones["fdgsdf"] = "value" -- string zones[function () end] = "value" -- function --etc.
  4. Element data isn't bound to dimensions, unless you control it clientside without sync it. A better solution would be: setElementData(element, "key" .. "_dimension:" .. dimension, value) setElementData(element, "key" .. "_dim:" .. dimension, value) Or: local markerContainer = createElement("markerContainer") local marker1 = createMaker(...) setElementDimension(marker1, 0) setElementParent(marker1, markerContainer) setElementData(marker1, "key", "345456") local marker2 = createMaker(...) setElementDimension(marker2, 1) setElementParent(marker2, markerContainer) setElementData(marker2, "key", "cgghgj") ------------------------------------------------------------------------- addEventHandler("onMarkerHit", markerContainer, function (hitElement, matchingDimension) if matchingDimension then end end)
  5. A underline makes sense, because people understand that it means that the parameter has no purpose. But it is technically not skipping, as the underline is a variable after all. It just depends how you want to pass that information into the function. A single parameter that contains a table with multiple values works sometimes even better, because you can use it as an array(similar to parameters in a way) as well as an object.
  6. @s2sk Skipping a parameter. function test (...) local parameters = {...} local variable1 = parameters[1] local variable3 = parameters[3] print(variable1, variable3) end test(1,2,3)
  7. Nope, I am following the forum rules. The only thing I can do for you, is pointing you to the right information. Or helping you with the code you haven't written yet. https://wiki.multitheftauto.com/wiki/TeaEncode
  8. You can do some stuff with MTA Lua functions, but you need to know Lua for that.
  9. Well, lets first get back to basics. function () -- Yes We Can! end A function = something you can do. function shout() outputChatBox("Yes We Can!") end A function name = describes in short what the function does. `shout` setElementDimension We can set an element it's dimension, with `setElementDimension` local setElementDimension_ = setElementDimension We can now also set it with: `setElementDimension_` There are two variables `setElementDimension` and `setElementDimension_` that contain the same function reference. So why did I created another variable? setElementDimension_ Well, to make a wrapper. If you have for example a hamburger which you want to eat. Normally you can eat it directly, but now I wrap it up with some paper. Which means in order to execute the function `eat my hamburger` I also have to do the function `unwrap my hamburger`. I can case of a wrapper, you can execute both functions with just one function. Because it has to do more than it is already doing and you can't rewrite the native function. local setElementDimension_ = setElementDimension Re-save (wrapper function) function setElementDimension(theElement, dimension) -- ... end Overwrite the native function reference (only in the same resource) With these two steps I made sure that if I call the function setElementDimension, the wrapper function will be used instead. local setElementDimension_ = setElementDimension function setElementDimension(theElement, dimension) local result = setElementDimension_(theElement, dimension) return result end The next thing is to make sure that the wrapper function does at least the same as the native function. local setElementDimension_ = setElementDimension function setElementDimension(theElement, dimension) local previousDimension = getElementDimension(theElement) -- custom behaviour local result = setElementDimension_(theElement, dimension) -- custom behaviour if result then triggerEvent("onElementDimensionChange", theElement, dimension, previousDimension) end -- return result end Now you can customize your wrapper function. New behaviour: When ever you call the function setElementDimension in your script. The wrapper function will do the same thing + trigger the event onElementDimensionChange for it. With triggerEvent you can make a new custom event.
  10. 1. With a simple shader: https://wiki.multitheftauto.com/wiki/Element/Shader#Simple 2. Create shader: https://wiki.multitheftauto.com/wiki/DxCreateShader 3. Find texture names you want to replace: https://wiki.multitheftauto.com/wiki/Shader_examples#Texture_names 4. Create a texture of desert image: https://wiki.multitheftauto.com/wiki/DxCreateTexture 5. Set the texture to the shader with dxSetShaderValue https://wiki.multitheftauto.com/wiki/DxSetShaderValue 6.Apply shader to world: https://wiki.multitheftauto.com/wiki/EngineApplyShaderToWorldTexture
  11. IIYAMA

    [Question] Priv

    Show us the code, which causes your filepath problem. And also keep in mind that image-pixels are not the same format as images. Which are both accessible by the dxCreateTexture function, but should approach differently.
  12. Solve it from the source, since there is no native event. local setElementDimension_ = setElementDimension function setElementDimension(theElement, dimension) local previousDimension = getElementDimension(theElement) local result = setElementDimension_(theElement, dimension) if result then triggerEvent("onElementDimensionChange", theElement, dimension, previousDimension) end return result end (add this on the resources where you control the dimensions.)
  13. IIYAMA

    Images

    With a shader. https://wiki.multitheftauto.com/wiki/Element/Shader#Simple Create shader: https://wiki.multitheftauto.com/wiki/DxCreateShader Texture names: https://wiki.multitheftauto.com/wiki/Shader_examples#Texture_names
  14. IIYAMA

    Images

    hmmm where could that be... I know it! It is a `specific place!`
  15. First set ammo. https://wiki.multitheftauto.com/wiki/SetWeaponAmmo
  16. I am not sure, I hardly needed them. Just run the example of the wiki, to figure our what you need. https://wiki.multitheftauto.com/wiki/GetPedTask function displayMyTask () local x,y = 100,200 for k=0,4 do local a,b,c,d = getPedTask ( getLocalPlayer(), "primary", k ) dxDrawText ( "Primary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y ) y = y + 15 end y = y + 15 for k=0,5 do local a,b,c,d = getPedTask ( getLocalPlayer(), "secondary", k ) dxDrawText ( "Secondary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y ) y = y + 15 end end addEventHandler ( "onClientRender", root, displayMyTask ) (x and y are screen positions) (a, b, c, d are the task information) You can also use bindkey: https://wiki.multitheftauto.com/wiki/BindKey But that doesn't tell you if a ped is actually doing the animation/task. bindKey("fire", "down", function () end)
  17. https://wiki.multitheftauto.com/wiki/GetPedTask
  18. Using JSON as Dimos7 said. Or just use directly a table: do -- set local theTable = {a = 100} setElementData(player, "hitMarkers", theTable) end do -- update local theTable = getElementData(player, "hitMarkers") theTable.b = 200 setElementData(player, "hitMarkers", theTable) end do -- debug local theTable = getElementData(player, "hitMarkers") iprint(theTable) end Information about what is allowed inside of this table.
  19. DXT5 is the highest quality and as you said it does support alpha blending. I would pick DXT1 for low quality textures like sand or grass(floor layer). Which shouldn't be too high quality because of the old Anti-Aliasing in GTA. Saving that ram is just so important for old gpu's while drawing a lot of textures. Saving half of the ram, by just compressing it until the minimum. dxt3?, I wouldn't pick it either.
  20. you can use the in-game web browser to do the svg thingy.
  21. @Pirulax That is indeed related. The larger the texture, the more memory and processing time it cost. (DXT compression matters) So yes, to serve lower quality textures or none for players with lower fps is a solution.
  22. There is a type of element in MTA called textures. Which can be created with this function: https://wiki.multitheftauto.com/wiki/DxCreateTexture Textures are images saved in to the memory. Which makes them very fast to draw images in-game. You can also draw images by path, which is a very slow process because they have to be read out by file every frame. Shaders can use textures to draw them dynamic on in-game elements (and even animate them.) Which is this guy probably doing at the moment using community resources. But shaders and textures might be fast but for old computers they can be lagy.
  23. https://wiki.multitheftauto.com/wiki/OnClientPreRender If timeslice is higher than 25 ms for a while, then remove the textures. 25ms = 40 fps. Btw write it yourself, those are the rules of the scripting section!
  24. https://wiki.multitheftauto.com/wiki/GetPedTargetStart It starts here.
  25. The health loss is already removed of the player his health data when this even is fired(not from the visual representation). Make sure you add the loss to the health data before you make your calculations. Parameters element attacker, int weapon, int bodypart [, float loss ] LOSS
×
×
  • Create New...