• Content Count

  • Joined

  • Last visited

  • Days Won


_Ace last won the day on March 2

_Ace had the most liked content!

Community Reputation

20 Decent

About _Ace

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. from the 256+ indexes returned the first ones are bass, not sure what you are trying to do with the bass data, but if it is some visual effect you can check if those indexes met some value, something like if index[1]>0.3 then bass met = apply effect
  2. I think the problem maybe the scroll identified by the event is firing without the calculations, anyway let me know when you solve the problem
  3. so everything works but wheen resizing the bug appears? I see you alternated between the normal attachelements and the one with calculations with same results, this shouldn't happen maybe its the wheel size different then mine, try this line inside the onclientprerender function: attachElements(wheel1, vehicle, px1, py1, pz1+getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*getObjectScale(wheel1)-getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*0.70, wrx1, wry1, wrz1) this 0.70 is a offset increment to adjust the wheel Z, you change this value a bit more or less to check if it helps, the thing is using this line, the center of the whell should go up or down depending on the scroll and not stay in the same height, if its not happening check db3 if something is returning null btw, if you need I can send my full code to check if something helps, you can still do yours for the features you are adding like the wheel thickness etc
  4. yes thats correct, the onclientprerender will only do the positioning and rotation, and the onClientGUIScrollon function will only do the resizing, I dont get why you are getting those bugs since my function appears to be the same as yours, also I tested with 4 wheels no problem, just add the 4 objects and each one has its positions and attachelements, my function looks like this: command function = [create gui and hide normal car wheels; done once=(create 4 wheels objects and scale then to 0.7 just to first visual effect; start the onclienprerender function) ] onclientguiscroll function = [scale each wheel using the scroll position / 100] onclientprerender function = [ getVehicleComponentRotation for each wheel; getVehicleComponentPosition for each wheel; attachelements for each wheel ] maybe your onclientprerender function is auto incrementing some global variable, pls send your onclientprerender function
  5. you need to set 2 lines handling the attachments of wheels (attachelements) and they should be the same (the params), or this wheel jumping effect will happen, because the onclientprerender is fighting with the scrollbar event, so you can try setting the wheel size in a separate function from the onclientprerender, also check if your gui function is not recreating the wheel or reseting some variables, the way i did: the function that opens the gui create the wheel and attach to the car using offsets by getelementcomponentposition, and start the function with the onclientprerender, this is done once if I open the gui again, I have a if with return to prevent double execution, its looking like this: edit: I will try setting the 4 wheels to check if any bugs with the scrollbar
  6. https://wiki.multitheftauto.com/wiki/IsPedAiming https://wiki.multitheftauto.com/wiki/SetPlayerHudComponentVisible https://wiki.multitheftauto.com/wiki/DxDrawCircle https://wiki.multitheftauto.com/wiki/DxDrawLine https://wiki.multitheftauto.com/wiki/OnClientPreRender
  7. send your code, maybe the glitch is related to the scrollbar, I did some testing and the suspension effect is posible with setting a variable (z of https://wiki.multitheftauto.com/wiki/GetVehicleComponentPosition) to the attachelements Z offset instead of fixed number, for now it is required to adjust Z+- if trying with other car, but testing with one car the object wheel looks like a real one managed from gta, no bugs resizing or while driving
  8. I didnt see the angle problem before, I tested here and got the same wheel angle problem in the image you sent, the fix is simple: instead of using setelementrotation in the onclientprerender, use the last tree arguments in attachelements (the angle ones): attachElements(roda,getPedOccupiedVehicle(localPlayer),rodax,roday,rodaz+getElementDistanceFromCentreOfMassToBaseOfModel(roda)*getObjectScale(roda)-getElementDistanceFromCentreOfMassToBaseOfModel(roda),rodarx,rodary,rodarz) so I removed the setelementrotation and set the attachelements above to handle rotations, works nice at any angle plus seems to remove the wobbling, about the suspension I will do some more testing, and to remove the db3 warning you can set a command with a global flag to check if the code should proceed or halt, use if to check if the flag is true or false, if false use return, something like: if not wheelmanipulation then return end
  9. I made a video to show how its working, Im not sure if is the same effect you trying to do the part the changes the position while resizing is something like: addEventHandler("onClientGUIScroll", root, function(element) setObjectScale(roda,guiScrollBarGetScrollPosition(element)/10) attachElements(roda,getPedOccupiedVehicle(localPlayer),rodax,roday,rodaz+getElementDistanceFromCentreOfMassToBaseOfModel(roda)*getObjectScale(roda)-getElementDistanceFromCentreOfMassToBaseOfModel(roda)) end) with roda being the wheel object and rodax,roday,rodaz the attachelements offsets, to make the wheel object rotate with the real wheel I made a onclienprerender event getting the car z rotation and the wheel rotations: function rodarot() local vrotx,vroty,vrotz=getElementRotation(getPedOccupiedVehicle(localPlayer)) local rodarx,rodary,rodarz=getVehicleComponentRotation(getPedOccupiedVehicle(localPlayer),"wheel_rf_dummy") setElementRotation(roda,rodarx,rodary,rodarz+vrotz) end this code is not optimized nor checking for warnings/errors, just an example for use in a proper code
  10. I tested with: attachElements(wheel,getPedOccupiedVehicle(localPlayer),wheelx,wheely,whellz+getElementDistanceFromCentreOfMassToBaseOfModel(whell)*getObjectScale(whell)-getElementDistanceFromCentreOfMassToBaseOfModel(whell)) which means: position z of attached wheel + half the radius of the wheel multiplied by wheel scale + half the radius of the wheel the object wheel stayed in ground while resizing with the scrollbar, I will do some more testing regarding the rotations and soon I send you the example code
  11. I made a example, go to coords 0,0,0 and test the command: server: createPickup(0,0,10, 3, 1247) createPickup(0,5,20, 3, 1254) createPickup(10,0,10, 3, 1248) client: function pks() for i,p in ipairs(getElementsByType("pickup")) do local x,y,z=getElementPosition(localPlayer) local xb,yb,zb=getElementPosition(p) local sx,sy=getScreenFromWorldPosition(x,y,z+0.7) local sxb,syb=getScreenFromWorldPosition(xb,yb,zb) if isElement(p) and isElementOnScreen(p) and isLineOfSightClear(x,y,z+0.7,xb,yb,zb) and getDistanceBetweenPoints3D(x,y,z,xb,yb,zb)<400 then dxDrawLine(sx,sy,sxb,syb,tocolor(255, 255, 255)) dxDrawText("pickup id: "..getElementModel(p),sxb,syb,_,_,tocolor(255, 255, 0)) end end end function pksr() addEventHandler("onClientRender", root, pks) end addCommandHandler("pkps",pksr) I will list pickup ids within 400m, in camera angle and not blocked by objects (from skin position) I tested and its working but its just a test code, not checked for warnings or exception handling
  12. you need the wheels at ground level while moving the scrollbar? you can change the attachelements z offset, then you will need to calc the distance from the center off the wheel (the attached one) using https://wiki.multitheftauto.com/wiki/GetGroundPosition and https://wiki.multitheftauto.com/wiki/GetElementDistanceFromCentreOfMassToBaseOfModel Im not sure if this will work with resized object, but if not, you can https://wiki.multitheftauto.com/wiki/GetObjectScale to do the math, about the wheel rotations you can use: https://wiki.multitheftauto.com/wiki/GetVehicleComponentRotation and setElementRotation
  13. replace the second tank model to the swat tank or firetruck, (you need a vehicle with a turret) then attach the second tank to a rhino, make the rhino invisible using setElementAlpha, put a timer serverside, to get the rhino turret position and set it to the attached second tank (getVehicleTurretPosition and getVehicleTurretPosition) and you are done, the turret movement will not be super smooth even using 30ms timer, if you want smooth turret movement use onClientPreRender, but this will require more code to sync to the clients, I tested the server solution and it works fine, 2 tanks with functional cannons
  14. https://wiki.multitheftauto.com/wiki/FindRotation get player position and ped position, set their x and y in the findRotation params, then set the npc rotation with the returned value from findRotation, use setPedRotation to do so
  15. se eu entendi direito vc precisa as coordenadas do mapa f11 atraves de click ou algo assim? tem essa funcao getPlayerMapBoundingBox que talvez ajude, peguei esse exemplo da wiki, local screenSize = Vector2(guiGetScreenSize()) local function handleMapTargetBlip() if not isPlayerMapVisible() then showCursor(false, false) wasLeftMouseButtonPressed, wasRightMouseButtonPressed = false, false return end if not isCursorShowing() then showCursor(true, false) end local isLeftMouseButtonPressed = getKeyState("mouse1") if isLeftMouseButtonPressed and isLeftMouseButtonPressed ~= wasLeftMouseButtonPressed then local cursorPos, mapMin, mapMax = Vector2(getCursorPosition()) cursorPos.x, cursorPos.y = cursorPos.x * screenSize.x, cursorPos.y * screenSize.y do local mx, my, Mx, My = getPlayerMapBoundingBox() mapMin = Vector2(mx, my) mapMax = Vector2(Mx, My) end if cursorPos.x >= mapMin.x and cursorPos.y >= mapMin.y and cursorPos.x <= mapMax.x and cursorPos.y <= mapMax.y then local relPos = Vector2((cursorPos.x - mapMin.x) / (mapMax.x - mapMin.x), (cursorPos.y - mapMin.y) / (mapMax.y - mapMin.y)) local worldPlanePos = Vector2(6000 * (relPos.x - 0.5), 3000 - (relPos.y * 6000)) local worldPos = Vector3(worldPlanePos.x, worldPlanePos.y, getGroundPosition(worldPlanePos.x, worldPlanePos.y, 3000)) outputChatBox("x: "..worldPlanePos.x.." y: "..worldPlanePos.y.." z: "..getGroundPosition(worldPlanePos.x, worldPlanePos.y, 3000)) end end end addEventHandler("onClientRender", root, handleMapTargetBlip) e editei uma linha pra que saia as coords no chat quando clica no mapa do f11, mesmo que seu mapa seja diferente do padrao do mta vc pode aproveitar o algoritmo, as coords Z precisa estar perto do player pro getgroundposition funcionar, ou precisa teleportar antes o player pra perto pra carregar os dados de coll e ai sim achar a position Z do chao