Jump to content

IIYAMA

Scripting Moderators
  • Content Count

    5,428
  • Joined

  • Last visited

  • Days Won

    114

IIYAMA last won the day on September 15

IIYAMA had the most liked content!

Community Reputation

1,135 MTA Ambassador

About IIYAMA

  • Rank
    Scripting Moderator & User Guide Contributor
  • Birthday 01/01/2016

Details

  • Gang
    [HB]
  • Location
    Netherlands
  • Occupation
    I have never been to the streets of SA... so who knows?
  • Interests
    Design, scripting, UX/UI

Recent Profile Visitors

11,454 profile views
  1. use nil instead of false. false = is still something, even if it is not considered as positive value. nil = nothing false == nil -- false (unlike in languages like JS, where that is true because the === operator is not used.) Also increment the ID value, instead of doing it based on maxPlayers. Keep it simple. local ID = 0 --onPlayerJoin ID = ID + 1 setElementData(player,"id",ID) --
  2. Like this: local cam = getCamera() local rx, ry, rz = getElementRotation(cam) --[[ rx, ry, rz -- transformations ]] setElementRotation(cam, rx, ry, rz)
  3. Good question. It is not an easy thing to build this without cause performance/network issues. You will have to balance it out what you think is important. The best synchronization and most optimised version requires the most code. Note: The adjustable property is already synchronized. At the very basic. Client(only): - When somebody has entered an vehicle with an adjustable property, you know that it might change. - Check each frame if the value has changed, then change the offset. Incorrect information: Now to optimise that (so that not
  4. The following function will give you the information about raise/lowering: https://wiki.multitheftauto.com/wiki/GetVehicleAdjustableProperty If you get both states per vehicle. - When the vehicle is raised * Position (attach offset) * Rotation (attach offset) - When the vehicle is lowered. * Position (attach offset) * Rotation (attach offset) You should be able to compute interpolation (position/rotation) by using the adjustable property.
  5. Check this comment: This can give you the position in front of you or anywhere you want. Attach elements (static offset) can be done with: https://wiki.multitheftauto.com/wiki/AttachElements
  6. In most cases yes. There is of course the Matrix function which will return a matrix class. And it will indeed perform better for this user case. But I am not going to explain OOP and vectors, when people are not familiar with them / using them.
  7. Good job! The last example on that page can also be handy: If you change that a bit, to this: You will be able to create matrices based on position and rotation without the need of elements. 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
  8. Just copy the getPositionFromElementOffset function and place it above or below your code. No need to merge functions. Use it like this (inside of your function): local x, y, z = getPositionFromElementOffset(theVehicle, -3, 3.5, 0)
  9. Use the function: getPositionFromElementOffset Which you can find on this page, under examples: https://wiki.multitheftauto.com/wiki/GetElementMatrix That function allows you to get offset positions, no matter what rotation a vehicle has. -- Get the position of a point 1 unit above the element: x,y,z = getPositionFromElementOffset(element,0,0,1)
  10. Did you try to disable your hud resource and reconnect?
  11. In that case you can better use the X and Y position. For example working with chunks, like Minecraft does: local chunkSize = 50 function convertPositionToChunk (x, y) x = x + 3000 y = y + 3000 if x > 0 and x <= 6000 and y > 0 and y <= 6000 then return math.ceil(x / chunkSize), math.ceil(y / chunkSize) end return false -- not in a chunk = out of the map end print(convertPositionToChunk (100, 200)) Or use this to make your 500 colshapes. If you really want to know if it is an issue, then just test with a potato laptop.
  12. If that error shows up, it isn't only Members that is nil, but also the crew (sub-)table. Why don't you use your function? You can never trust data that has been inputted by a user after all. > doesCrewExist(crew)
  13. source is only available for events (functions that are executed when an event is triggered +addEventHandler). So it's value is in this case nil(no value). Use thePlayer instead, since you need a player element for the function 'getPlayerAccount.'
  14. Another problem, which is most likely that the clients haven't download/load the scripts yet, while receiving the avatar. The following code will trigger the onRequestImage event when the client has loaded his resource. Server function ShowImage () local player = client -- ... addEvent("onRequestImage", true) addEventHandler("onRequestImage", resourceRoot, ShowImage, false) Client addEventHandler("onClientResourceStart", resourceRoot, function () triggerServerEvent("onRequestImage", resourceRoot) end, false)
×
×
  • Create New...