Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. Have you already checked other dx libraries? It would be a waste of time to figure out everything from scratch don't you think? For example:
  2. Use getTickCount (milliseconds) if you do it based on machine time. Use getRealTime().timestamp (seconds) if you want realtime. When doing the calculations, start with the highest dimension. hours = math.floor(seconds / (60 * 60)) seconds = seconds - (hours * 60 * 60) progress = seconds / (60 * 60) You can also use %, to cut off large dimensions. Starting with the dimension you do not needs. Need hours + rest? = cut off days But that doesn't work for days/years, since there are not always 365 days in a year. Progress goes from 0 to 0,9999999999.
  3. I do not know that script, but I can explain Lua OOP a little bit. At the very basic OOP is about creating objects and consider them as things and not just a data type, in Lua that is in this case a table. And as you know, you can add a lot of things in tables. It is a container used to keep things together. In the concept OOP, functions are part of this container as well. To keep things together, all functions that are saved inside can be used as being part of the table(container) it SELF. Which is where the keyword self comes from. Some people refere to `functions` that are inside of tables/objects as `methods`. Because those functions are used to modify or use data from the table, it becomes an action that the table can do. self is a key word, that reference to the table, where a method/function is saved in. If the function is not called from the table(container), self will become unavailable. The concept here is to keep the self/table as close as possible to the action the function must perform. t = {} function t:printSelf() print(self) end t:printSelf() ----- t = {123} function t:getValue () print(self[1]) end t:getValue()
  4. It is possible, but what is the real problem? - The synchronisation concept for the data? Or - How to use OOP?
  5. Unfortunately that might not be the case. For example if you have 2 of those red boxes in each other and rotate 1 of them. There is another method that might be helpful if only 0, 90, 180 270 are used. Step 1, normalize the width, height and depth. So that rotation doesn't play any role anymore. https://wiki.multitheftauto.com/wiki/GetElementBoundingBox getPositionFromElementOffset < https://wiki.multitheftauto.com/wiki/GetElementMatrix Not required: Change your ^imationary^ camera from top to bottom. Get the center position X from both. Compare the distance: distanceX = [positionX_box1, positionX_box2] if distanceX < (sizeX_box1 / 2) + (sizeX_box2 / 2) then Do the same for the Y and Z axis. When all are true, there is a collision.
  6. But keep in mind that the solution is not bullet proof. If the red box was 45 degrees rotated clockwise and moved a little bit higher, the collision detection would fail.
  7. You could also use this function. https://wiki.multitheftauto.com/wiki/IsInsideColShape https://wiki.multitheftauto.com/wiki/GetElementBoundingBox If you run it 8x times for each corner, per object = 16x. Then it will detect most of the collisions, except when no corners are inside each other. There is also something by crystamv. https://web.archive.org/web/20160507103732/http://crystalmv.net84.net/pages/scripts/server_coldata.php But that one only supports peds and vehicles. But you could modify it to also support objects
  8. You can multiply the colshape size by 1.5. But keep in mind that rotation values that are higher than: (rotation % 90) > 0 Will make the calculations invalid.
  9. Moved to correct language section. (Not sure if this is the correct sub-section...???)
  10. @koragg Unfortunately I will be away for a long while, so I can't test it out. Please ignore the following if this is not helpful. The code below was one of my experiments to create an animator. While it maybe working very well, it also was not worthed to add something as big inside of my resources, because of the size and feature count. But what it does is setting up parameters/arguments and adding animations to them. opacityStart = 0 opacityStart = 255 opacityStart = 0 So you might consider use it as inspiration to creating your own animator, smaller/bigger. (or copy this...) Uses https://forum.multitheftauto.com/topic/103866-enchantment-client-render-events-enchanting/
  11. Moved to resources, since it was a scripting request.
  12. If you are not are not (going to be) a programmer, then this is not the right section to post this. I will move your topic to resources, where you can request what you need. See also this section: https://forum.multitheftauto.com/forum/149-looking-for-staff/ Please read the guidelines of the scripting section:
  13. Did you add the download able assets(+ html) in to the meta.xml? (And check if those files are actually downloaded in the client folder) https://wiki.multitheftauto.com/wiki/CEF_Tutorial That is afaik serving files from serverside.
  14. Serverside is not complete at the very detail level of code instructions. Another script alone can't fill those unfinished parts.
  15. The resource/script is unfinished. You should ask the creator to finish it, finish it yourself or download a resource that is finished.
  16. function repair(_,state) if state == "down" then if isCursorOnElement(screenW * 0.5490, screenH * 0.4648, screenW * 0.6808, screenH * 0.5169) then if Kit_Reparo >= 1 then triggerEvent("startRepair", root) removeEventHandler("onClientRender", root, painelR) painel = false showCursor(false) else exports._infobox:addNotification("Você não possui kit de reparo!", "error") end end end end addEventHandler("onClientClick", root, repair) This addEventHandler is always attached and there is no validation that checks if the panel is open/button is visible.
  17. This rectangle exist out of 7 parts. - 4 corners - 1 big rectangle, the middle, from left to right - 2 small rectangles, top and bottom You can animate the big rectangle it's width and height. (+ Position, if not animated from left-top) The 2 small rectangles, their width and position. And the corners, their position. But make sure to align the components perfectly with the pixels on the screen. Half pixels might cause artifacts.
  18. Same here ? As far as I understand of the wiki. - You have group id's which are kind of slots you can use. I don't think you have to create them. Just use 1 for your first try. - Assign the object models you want to change to the group 1. - Then set the properties which you think you need to achieve your goal.
  19. @Sisqo0 Did you know that there are id functions available? Which are very similar to those that are used in html/css/js. https://wiki.multitheftauto.com/wiki/SetElementID https://wiki.multitheftauto.com/wiki/GetElementByID
  20. https://wiki.multitheftauto.com/wiki/EngineSetObjectGroupPhysicalProperty https://wiki.multitheftauto.com/wiki/EngineSetModelPhysicalPropertiesGroup Some new functions you can try.
  21. I am not sure which version you are using. But the resource might be working fine for your server, if you do the following: Remove the following line from your meta.xml <min_mta_version server="???" client="???" /> But be aware that you might see some warnings, which are related to functions that are not available inside of your server (version). setPedsLODDistance = available ??? setVehiclesLODDistance = available ??? Updating your server, might be handy if you want to be able to use the resources that use the newest features.
  22. The resource has been unpacked, which is already a change. (not required to unpack, except in special cases) The resource name has been changed, since it original is written lowercase. Which are not really changes that can cause big problems... but you definitely did make changes. What happens if you use the /refreshall command as administrator? Check the server window to see if there are any errors and if the resource is available.
  23. Add the keyword: in for k,msg in ipairs (badwords) do Syntax: http://www.Lua.org/manual/5.1/manual.html#pdf-ipairs
  24. What did you try? Because setPlayerHudComponentVisible works, unless another script overwrite it's state.
×
×
  • Create New...