Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. 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!
  2. 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.
  3. 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)
  4. 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)
  5. @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.
  6. 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
  7. Locked
  8. 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. ?
  9. Just flip the roll, when the vehicle is on it's back. 0 <OR> 180
  10. 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.
  11. Then you have to synchronise this status with the server, for each player. Try to build that first.
  12. use: root It holds all players. (localPlayer + remoteplayers)
  13. 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?
  14. Locked for triple posting and wrong section language.
  15. Locked for triple posting, wrong section(this post was in tutorials) and wrong section language.
  16. The data type time in your database is not something you should animate. https://wiki.multitheftauto.com/wiki/GetRealTime Create your end time: (seconds) > End time (start time + duration) That is all you have to save. Remaining time = (End time - current time)
  17. local x, y, z = getElementPosition(source) local xr, yr, zr = getElementRotation(source) local playerData = {x=x, y=y, z=z, xr=xr, yr=yr, zr=zr} Those 2 functions do not return a table, but multiple variables.
  18. https://wiki.multitheftauto.com/wiki/OnClientPlayerVehicleEnter onClientPlayerVehicleEnter can also trigger for the remotePlayers(players other than yourself). So that issue doesn't require any serverside code. ------------------------------------------------- If you want to learn how to sync data, you could start with something not so complicated. And later learn how to use triggerEvents.
  19. Locked for topic bumping. If nobody wants to help you, then there must be something wrong with the information you provide. Or maybe your request is unacceptable. Think about it.
  20. Dit you check out how adminpanel does it? (Vehicle select)
  21. It is not a MTA function. Get it from here: https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPointAndSegment2D
  22. @WorthlessCynomys isElement -- instead of getElementType
  23. The 2D way. First translate the 3D start and end point to 2D. With this function: https://wiki.multitheftauto.com/wiki/GetScreenFromWorldPosition You have now a 2D line instead of a 3D. Next Get the distance between the 2D line and point(your cursor) with: https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPointAndSegment2D
  24. I have heard about this issue before, but not sure if people actually fixed it. The object orientation is updated every frame. But for some unknown reason there is a little delay. With other words: I don't know. Maybe add an extra eventHandler in file bone_attach_c.Lua: addEventHandler("onClientPreRender",root,putAttachedElementsOnBones) --[[ line 85 ]] addEventHandler("onClientRender",root,putAttachedElementsOnBones) --[[ NEW on line 86 ]] If you look at the event order: https://wiki.multitheftauto.com/wiki/Game_Processing_Order You can see that onClientPreRender event first fires and onClientRender fires as last. Maybe if updates are applied on both moments it could be a little bit smoother. Could could could > so not sure.
  25. It is most of the time not a matter of what they show, but which ones aren't shown. Between the ones that are shown and the ones that are NOT shows is your problem. Even if you think such useful information is useless, there will be a time you will think different about your previous reply.
×
×
  • Create New...