Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. Use timestamp. Check the docs. And no I currently can't give any examples as I am extremely busy with a real life project that is killing all the hours I have. Please ask somebody else.
  2. This is a memory leak, most likely created by one of your scripts. Use the performance browser to find the responsible resource: (Category - Lua memory???) https://wiki.multitheftauto.com/wiki/Resource:Performancebrowser Best of luck
  3. With: https://wiki.multitheftauto.com/wiki/SetElementFrozen
  4. @SuperM Open your map file in your text editor. Search for the id. And give the node the attribute: frozen="true". (Check if the attribute is already added) Add it like that: (don't copy/past) <object frozen="true"></object> https://wiki.multitheftauto.com/wiki/Element/Object
  5. IIYAMA

    TGA Reader

    @XaskeL Unfortunately I can't answer this question. But one thing I noticed is you are making it too complex and putting stress on your MTA application. If you want to read and write pixels, why not let a secondary application take care of that? You are just blocking your MTA thread after all. https://www.npmjs.com/package/@rgba-image/pixel https://www.npmjs.com/package/get-pixels (Also you might find an answer to your question in the source code of those two node applications) Do with it what you want, best of luck!
  6. This information might also be useful for you: local x, y, z = 0, 0, 10 local rx, ry, rz = 0, 0, 0 -- test rx, ry, rz = (rx + math.random(3)) % 360, (ry + math.random(3)) % 360, (rz + math.random(3)) % 360 -- local m = createMatrix(x, y, z, rx, ry, rz ) local startX, startY, startZ = getPositionFromMatrixOffset(m, 0, 1, 0) local endX, endY, endZ = getPositionFromMatrixOffset(m, 0, -1, 0) local faceTowardX, faceTowardY, faceTowardZ = getPositionFromMatrixOffset(m, 1, 0, 0) (functions are on that topic)
  7. For this you indeed need to use dxDrawMaterialLine3D. This is actually not the right section for details about COLS (collision files). (unless it is only for the replacement code) You will have more luck with that in: https://forum.multitheftauto.com/forum/177-modelling/ + you can figure out which people have knowledge about it.
  8. Are you going to create lights under the ped his feet? Or a shadow as image? Hmmmhmmhmmmmm Could work, but it is still not clear what the ultimate goal is. Btw. See also this function: https://wiki.multitheftauto.com/wiki/ProcessLineOfSight It it doesn't only tell you if the line is clear, it also detects the collision position. (And much more: material, surfaces orientation, vehicle parts)
  9. See also: https://wiki.multitheftauto.com/wiki/OnPlayerContact
  10. @playerpocket https://forum.multitheftauto.com/forum/127-programação-em-Lua/ General MTA > Other languages > Portuguese / Português > Programação em Lua = https://forum.multitheftauto.com/forum/71-scripting/ MTA Community > Scripting (+ Língua portuguesa) = Thank you, IIYAMA
  11. I just looked in to your source code, because I got curious. (I haven't tried the resource, no time for now) But the variable alapLo, where is it defined? Just wondering. Anyway, keep up the nice work!
  12. This might help you: (based on these examples) function createMatrix(x, y, z, rx, ry, rz) rx, ry, rz = math.rad(rx), math.rad(ry), math.rad(rz) local matrix = {} matrix[1] = {} matrix[1][1] = math.cos(rz)*math.cos(ry) - math.sin(rz)*math.sin(rx)*math.sin(ry) matrix[1][2] = math.cos(ry)*math.sin(rz) + math.cos(rz)*math.sin(rx)*math.sin(ry) matrix[1][3] = -math.cos(rx)*math.sin(ry) matrix[1][4] = 1 matrix[2] = {} matrix[2][1] = -math.cos(rx)*math.sin(rz) matrix[2][2] = math.cos(rz)*math.cos(rx) matrix[2][3] = math.sin(rx) matrix[2][4] = 1 matrix[3] = {} matrix[3][1] = math.cos(rz)*math.sin(ry) + math.cos(ry)*math.sin(rz)*math.sin(rx) matrix[3][2] = math.sin(rz)*math.sin(ry) - math.cos(rz)*math.cos(ry)*math.sin(rx) matrix[3][3] = math.cos(rx)*math.cos(ry) matrix[3][4] = 1 matrix[4] = {} matrix[4][1], matrix[4][2], matrix[4][3] = x, y, z matrix[4][4] = 1 return matrix end function getPositionFromMatrixOffset(m, offX, offY, offZ) local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end With this you can calculate from every orientation the matrix and offset positions. Feel free to apply a different rotation value, so that the offset is also turning. Optional method: (but might not be 100% accurate) Between 2 positions in front of you can rotate the camera, see: https://wiki.multitheftauto.com/wiki/InterpolateBetween I hope this will make you see the light, it did for me when doing complex 3D calculations.
  13. To be honest, I haven't encountered any issues with it yet. But I am pretty sure that it can have issues when memory has been wiped because of an <unknown situation>. I would suggest following Awang his suggestion: If applied, you probably do not need that onClientRestore event. It might also improve performance, because it is static. local texture = dxCreateTexture(dxGetTexturePixels(rt)) dxSetShaderValue(theShader, "gTexture", texture)
  14. Just don't render it with renderContent. Shaders applied to game elements do not require updates every frame. (Unless you want to update them with Lua > update the texture or update the shader values)
  15. @Overkillz You can do it with 1 shader, and just before drawing, switch the texture value of it foreach player. But I am not sure, how high the performance penalty is. So both ways will work, but I am not sure which one is the best one.
  16. IIYAMA

    UNBINDKEY

    With this function: (Included examples) https://wiki.multitheftauto.com/wiki/ToggleControl See here the list of control names you can enabled and disable: https://wiki.multitheftauto.com/wiki/Control_names
  17. That is for you to find out. https://wiki.multitheftauto.com/wiki/GetCamera https://wiki.multitheftauto.com/wiki/GetElementRotation local camera = getCamera () local rx, ry, rz = getElementRotation(camera) Also you can just attach the camera element to the ped or vehicle. ?
  18. Just flip the roll, when the vehicle is on it's back. 0 <OR> 180
  19. Can you please stop bumping? (3e bump) If you continue, I will have to lock your topic, not matter the reason. Bumping is annoying for everybody that wants to keep track of content they have already checked. Please think about that. Normally I would lock a topic after a 2e bump, but for the people that replied I will leave it open for now.
  20. Then you have to synchronise this status with the server, for each player. Try to build that first.
  21. use: root It holds all players. (localPlayer + remoteplayers)
  22. Creating a new table is a slower method, but nothing to worry about. You wouldn't notice the difference with the computers these days. You didn't need the pack function to do this: local pos = {getElementPosition(source)} But if it helps you with readability, then why not a pack function?
  23. Locked for triple posting and wrong section language.
×
×
  • Create New...