• Announcements

    • jhxp

      Forums are online again after a maintenance.   18/03/17

      MTA Forums maintenance is completed, although some automatic time-heavy tasks are still in process and will be finished eventually in background. Expect some features such as Forum Search to not display all results until all processes are finished. Please let us know if you spot a forum feature that worked correctly before the maintenance but does not work anymore now. Thanks. --MTA Team


  • Content count

  • Joined

  • Last visited

  • Days Won


IIYAMA last won the day on May 23

IIYAMA had the most liked content!

Community Reputation

37 Good



  • Rank
  • Birthday 01/01/16


  • Gang
  • Location

Recent Profile Visitors

786 profile views
  1. How about you try to pre render it? > onClientPreRender < Maybe the GTA is re-adjusting the wheels every frame.
  2. I wonder if you can rotate tires like that. Why don't you try it with: https://wiki.multitheftauto.com/wiki/SetAnalogControlState ? Since you are only rotating the Z as.
  3. You might want to reply @klaw , it is a bit rude if you do not.
  4. You might want to reply @pepsi18 it is a bit rude if you do not.
  5. I could have written it better. I skipped here and there some words, but I am happy that you like it. P.s: Learning tables will make you a god at scripting systems like this.
  6. I came up with an easier concept for it. This will compare the centres of the rectangles with each other, which only requires 4 conditions. local rectangleX1, rectangleY1 = 25, 0 local rectangleX2, rectangleY2 = -25, 10 local rectangleSizeX, rectangleSizeY = 50, 50 function isRectangleInRectangle(X1, Y1, sizeX1, sizeY1, X2, Y2, sizeX2, sizeY2) local centreX1, centreY1 = X1 + sizeX1 / 2, Y1 + sizeY1 / 2 local centreX2, centreY2 = X2 + sizeX2 / 2, Y2 + sizeY2 / 2 local distanceX = centreX1 - centreX2 local distanceY = centreY1 - centreY2 if distanceX < 0 then distanceX = -distanceX end if distanceY < 0 then distanceY = -distanceY end if distanceX <= sizeX1 / 2 + sizeX2 / 2 and distanceY <= sizeY1 / 2 + sizeY2 / 2 then return true end return false end iprint(tostring(isRectangleInRectangle(rectangleX1, rectangleY1, rectangleSizeX, rectangleSizeY, rectangleX2, rectangleY2, rectangleSizeX, rectangleSizeY)))
  7. nvm you are right. I think I am a bit tired, that must be the problem. I will solve it for you tomorrow if nobody already solved it for you.
  8. sides should be included afaik, my bad for forgetting to mention that. It is untested, so test it with all possible combinations you can come up with.
  9. local posX = posX + sX * 0.025 + 61 Try to play with line 82 a bit. It will not fix all your problems, but it is a start.
  10. local rectangleX1, rectangleY1 = 20, -48 local rectangleX2, rectangleY2 = 60, -5 local rectangleSizeX, rectangleSizeY = 50, 50 function isRectangleInRectangle (X1, Y1, sizeX1, sizeY1, X2, Y2, sizeX2, sizeY2) if (X1 > X2 and Y1 > Y2 and X1 < X2 + sizeX2 and Y1 < Y2 + sizeY2) or (X1 + sizeX1 < X2 + sizeX2 and Y1 + sizeY1 < Y2 + sizeY2 and X1 + sizeX1 > X2 and Y1 + sizeY1 > Y2) then return true end return false end iprint(tostring(isRectangleInRectangle(rectangleX1, rectangleY1, rectangleSizeX, rectangleSizeY, rectangleX2, rectangleY2, rectangleSizeX, rectangleSizeY))) try this, untested. It will check if the TOP+LEFT or BOTTOM+RIGHT is inside the other rectangle. (This doesn't work when you rotate the rectangle)
  11. Elementdata: Uses ~7x times less data in comparison with the triggerEvent. (I haven't been able to test it with accurate results, but you can assume it is 7 times less usage.) Automatic send to new joiners, because it becomes part of the element itself. Disable synchronization can be useful for sharing data between resources without wasting the network. triggerEvent: Normal triggerEvent variant sends faster data than elementdata. Latent trigger event can be used. (The latent variable, which makes it possible to send it slowly and without blocking the network) Can be send to a specific player / list. (Which makes it possible to reduce network usage for clients that don't need the data.) Afaik it can handle large amount of data better. For a nametag, elementdata wouldn't be a bad idea. Since everybody in the server need to see that a specific player is admin, right? So it is better to pick the method that suits best for the situation. And it is even better if you mind disabling synchronization when you only need it one side. Elementdata can indeed ruin your server if you use it not carefully enough. Take a look at the mini-mission server, it laggs like hell.
  12. The concept of letting serverside and clientside work together isn't very difficult. It actually the same as you and me having a conversation. You communicate with me that you have a problem with a script. Noah > IIYAMA Then I reply on your topic and gave you some tips. IIYAMA > Noah Then you process those tips and send me request to send you more information. Noah > IIYAMA Which I am sending you back now. IIYAMA > Noah During this conversation you have send me 2 messages and I have send you 2 messages back. @koragg showed you the functions you can use to start a conversation. Lets start a conversation between the Server and all clients! So a part of the conversation goes like this: (the rest of the conditions you have to fill in by yourself) Server: A lonely player named <John> enters a lonely vehicle. 'onVehicleEnter' gets triggered on serverside. Lets give the vehicle weapon so it can kill other lonely players!!! The server saves that the vehicle has a weapon now(for example in to a table). Oh great it has been saved! Now let all lonely players know that a vehicle has super weapons! triggerClientEvent to all the players. Clients: Oh man we all got mail from the server!! It said that a lonely vehicle has weapons now!! Now we all have to attach weapons to it on all our computers! Noooo!! This sucks damn. setElementParent(weapon, vehicle) Client: The lonely player named <John> pushed his left mouse button down! Yes, I am an a vehicle. Yes, it is a hydra. Yes, I am happy to be alive. Server, I am firing up!!! setElementData on his vehicle firing true. Clients: I received element:~yData oh oh. It said that a lonely hydra is firing fire! Which weapons did I attach on it? Ah wait I added them a few seconds ago, when a lonely player entered his lonely vehicle! Lets fire these hydra flame weapons! setWeaponState firing true Server: A lonely player named <John> crashed his hydra into his mother. There was nothing left of his mother, neither of his poor hydra dragon. setElementData on his vehicle firing false. Clients: I received element:~yData oh oh. It said that a lonely hydra isn't firing any more. What could have happened? setWeaponState firing false.
  13. local progress = 55 -- 55% local amountOfSegments = 5 -- the amount of bars / segments local progressPerSegment = (100 / amountOfSegments) -- when you devide the total progress over the segment count, you will know how much percentage every segment is. local remainingProgress = progress % progressPerSegment -- the next step is to calculate how much percentage is left over after removing all full bars of it. So for example ever segment is 10% and you have 95% health, it will subtrack 10 from 95 as much as possible. At the end 5% will remain. local segmentsFull = math.floor(progress / progressPerSegment) -- it is usefull to know how much bars are full, so that you can fill those up. local segmentsInUse = math.ceil(progress / progressPerSegment) -- This will show you have many bars do contain any health. iprint("segmentsFull: " .. segmentsFull) iprint("segmentsInUse: " .. segmentsInUse) iprint("remainingProgress: " .. remainingProgress) for i=1, amountOfSegments do if i <= segmentsFull then -- draw a fulled health line iprint("full") else -- draw a fulled [gray] health line iprint("background") if i == segmentsInUse and remainingProgress > 0 then -- draw a health line depending on the remainingProgress iprint("remaining " .. tostring(remainingProgress)) else iprint("empty") end end end
  14. First of all you have to make a choice: Do you you want to use serverside as support for security and data validation? If not, then here are some reasons why the code isn't synchronized correctly and also how to counter those problems. You can't share client created elements with elementdata. To counter this you have to create for every client those weapons and set elementdata at the vehicle instead. So setElementData(vehicle, "weaponHydraL", weapon, false) -- disable the synchronization, else you will get trouble. You attach those weapons at the moment the vehicle gets streamed in or when it is already streamed in. There are events and functions for that. Sync weapon fire isn't working because of the first reason. setElementData(vehicle, "weaponFire", true, true) -- do sync this and catch up with: https://wiki.multitheftauto.com/wiki/OnClientElementDataChange > setWeaponState Keep debugging:
  15. I am using elementdata now with sync off. Using an export function might also be a good idea. Yea strange that wasEventCancelled didn't work.