Jump to content

Overkillz

Members
  • Posts

    545
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Overkillz

  1. Overkillz

    help

    Just use a boolean to check if is running or not. triggerEvent("trig", resourceRoot) local isRunning = false addEvent("trig", true) function trig() if not isRunning then isRunning = true ... end end addEventHandler("trig", resourceRoot, trig)
  2. Overkillz

    help

    Could you be more specified ? If you want to remove an event to prevent his execution, just, don't execute it. Regards.
  3. dxGetTextWidth() Just gives you the width of a text depending of the font and size. It is not going to fix your issue if you are going to use Hexadecimal color codes with the clipping or wordbreaking function. You are just doing the 'invisible' box of the text adjusted to the text width.. Regards.
  4. @Zango Thanks for your help. Yes, I had been looking for creating a line which was orthogonal to the vehicle. However, Im so curious. I already see that with the Matrix you can get the rotation, offset ...etc of an element. However, there are somo arrays that I cant figure out how to deal with them. For what is used each array ? If you can clear me this question. Thanks for reading, regards.
  5. Of couse, you can use dxCreateRenderTarget. dxCreateRenderTarget() However, it will give you less quality unless you use dxSetBlendMode dxSetBlendMode()
  6. Hello dear community, Im haivng an issue which is giving me some troubles. Im trying to project a line 3D between 2 points, the vehicle which is on the air and the ground. Here is an example how it is drawn and how it is supposed to be drawn (WHITE line is how it is drawn and RED Line is how it should be drawn ) Sadly, I can't figure out how to use the proper maths here. local x,y,z = getElementPosition(theVehicle) local rx,ry,rz = getElementRotation(theVehicle) local ground = getGroundPosition(x,y,z) dxDrawLine3D(x,y,z,x+rx,y+ry,ground) I hope you can bring me a hand with this problem Thanks in advance, regards.
  7. How that it is cancelling. Im just doing setCameraTarget just to 'lets say Restore' the default MTA Camera to later apply the camera Matrix. Do I need to restore the camera player fully before I apply the cameraatrix to a specific position ? And yes, Im executing this function before execute the previous one mentioned. setCustomCameraTarget()
  8. I tried it. After leaving the arena I did this setTimer(triggerServerEvent,2000,1,"onForceSpawnLobbyPlayer",localPlayer) And serverside function forceSpawnLobbyPlayer() outputChatBox("Forcing Camera Matrix") spawnPlayer(source, 0, 0, 5, 90, 0,0, 30) setElementFrozen(source,true) setCameraTarget(source,source) setCameraMatrix(source,488.32220458984,-1607.4827880859,37.201072692871,399.98428344727,-1560.7738037109,41.033145904541) end addEvent("onForceSpawnLobbyPlayer",true) addEventHandler( "onForceSpawnLobbyPlayer",getRootElement(),forceSpawnLobbyPlayer) It is executed, but nothing. Im still not getting the camera player.
  9. @IIYAMA This one. Just using the function setCustomCameraTarget(theElement) local rotX, rotY, rotRadius, maxRadius = 0, -math.pi/2, 10, 20 local isCustomCamera = false local cameraTarget = nil local sX, sY = guiGetScreenSize() addEventHandler("onClientPreRender", root, function() if isCustomCamera and isElement(cameraTarget) then local x, y, z = getElementPosition( cameraTarget ) local cx, cy, cz cx = x + rotRadius * math.sin(rotY) * math.cos(rotX) cy = y + rotRadius * math.sin(rotY) * math.sin(rotX) cz = z + rotRadius * math.cos(rotY) local hit, hitX, hitY, hitZ = processLineOfSight(x, y, z, cx, cy, cz, _, false, _, _, _, _, _, _, cameraTarget) if hit then cx, cy, cz = hitX, hitY, hitZ end setCameraMatrix( cx, cy, cz, x, y, z ) end end ) addEventHandler("onClientKey", root, function(button) if button == "mouse_wheel_up" then rotRadius = math.max(2, rotRadius - 1) elseif button == "mouse_wheel_down" then rotRadius = math.min(maxRadius, rotRadius + 1) end end ) addEventHandler("onClientCursorMove", root, function(cX,cY,aX,aY) if isCursorShowing() or isMTAWindowActive() then return end aX = aX - sX/2 aY = aY - sY/2 rotX = rotX - aX * 0.01745 * 0.3 rotY = math.min(-0.02, math.max( rotY + aY * 0.01745 * 0.3, -3.11 ) ) end ) function setCustomCameraTarget(element) if isElement(element) then cameraTarget = element isCustomCamera = true return true else cameraTarget = nil isCustomCamera = false end end
  10. Do you really need 'HELP' ? Could you just try to do your own code and try to comeback to this topic again ... Regards.
  11. @IIYAMA Thanks for your answer, but I didn't get u at all. Sorry ? Practically Im managing the camera by a single resource. I will tell you step by step what do I do ? The fisrt thing I do is join to the arena, in this case is the garage arena. Inside the arena I only do is to spawn the player and setCameraTarget. Later use the custom camera script aimming to a vehicle. When I leave the arena (I try to set the Default MTA Camera using setCameraTarget) In this case it doesn't work, so I kill the player, spawn it again and set again the default mta camera. Obyously I have removed the custom camera events and restore the varaibles previously but nothing. As I said before, even using onClientPreRender, onClientRender or whatever the camera doesn't work. Thanks for reading and best Regards.
  12. Yes, but it is not working. Idk if there are other ways to simulate or force the function setCameraMatrix. Might attaching a cam, but Im not sure if you know how to deal with this weird issue. Regards.
  13. Ohh. I see. I wasn't aware about the streamed argument. Respecting the elements tree, the functionallity looks interesting. Might It could bring me a better result isntead dealing with arrays. Thanks newly It helped me a lot. Regards.
  14. Overkillz

    /sp

    Each time you press the key that handle the function you need to get your current location getElementPosition() and set a new one increasing one of the float of your current one. Something like this local increaseBy = 3 local x,y,z = getElementPosition(localPlayer) setElementPosition(localPlayer,x,y,z+increaseBy)
  15. It looks interesting but looks like it requieres a higher performance than a simple id for each element inside a table or elementsData. I know that it could be the right choice for other cases (Not for mine in this case) Anyways I have no doubts that Im going to use it in a future. Thanks for the information. I have another question. Im working with different dimensions. My question is, if some of the players are in the same dimension like me and i try to get all the vehicles using getElementsByType. Will it drop me all the vehicles in the same dimension or from all dimension ? I know I can use other ways like getting the players dimension ...etc. But is just a question that have took all my attention. Thanks for reading. Regards.
  16. Hello dear community, Im trying to create a preview of all the spawns from a map. In this case, the spawns are vehicles. Well, I need to hide the preview spawn if the playerVehicle is over the preview spawn. I know i can check the position of the playerVehicle and compare it with the spawn preview or adding an ID where Im storing all the spawn preview and another alternatives. But my question is, is there a function that check it? i know it sounds weird. Thanks for reading, best regards.
  17. Overkillz

    /sp

    You can get your current location and increase any of the floats with the value you want.
  18. Assuming that you are asking for the max health of the player. I couldn't remember if max player health is 1000. for i,player in ipairs(getElementsByType("player")) do setElementHealth(player,1000) end
  19. Hello dear community. Im having a big issue with setCameraMatrix on the clientside. Well, I needed to set a custom camera target to an object (This script is an adaptation of @Sasu) Well, my problem is that when Im using that custom camera target and I want to restore the camera to the player. It doesn't work. I tried several ways and events like onClientRender, onClientPreRender ... I tried to spawn again the player, setCameraTarget (The default one) and later use the setCameraMatrix and to re-force it. add the setCameraMatrix inside a function handled by onClientRender. Before I've used setCameraMatrix I removed the events used for the custom camera target and set the varaibles (cameraTarget & isCustomCamera) as nil & false. I hope you can bring me a hand with this issue. Any information that u need just comment below and I will bring you more details. Best regards.
  20. @Felix5k Yes, as you can see im getting the drop message but with the 2nd way.
  21. Well, Im going to be clear. Why is this not working ? --##Resource A exports["resource_Name"].testExportF("Hello") --##Resource B function testExportF(message) outputChatBox(testStringA) end --RESULT: bad argument @ 'outputChatBox' [Expected string ar argument 1, got nil] And why is this working with a 2nd argument --##Resource A exports["resource_Name"].testExportF("Hello", "hello2") --##Resource B function testExportF(message) outputChatBox(testStringA) end --RESULT: hello2 Exported function is clientside as u can see and resource name doesn't containt illegal characters Regards.
  22. --##Client Side function myClientCommandFunction(cmd, value1, value2) if tonumber(value1) and tonumber(value2) then --DO WHATEVER else --SAY SYNTAX ERROR (MISSING COMMAND OR NOT NUMBER) end end addCommandHandler("cCommand",myClientCommandFunction) --##Server Side function myServerCommandFunction(cmd, thePlayer, value1, value2) if tonumber(value1) and tonumber(value2) then --DO WHATEVER else --SAY SYNTAX ERROR (MISSING COMMAND OR NOT NUMBER) end end addCommandHandler("sCommand",myServerCommandFunction)
  23. I already know about looping them using pairs to prevent breaks when an index is not detected between 2 numbers like the (2nd & 8th) But, here is my real question. For example. Im drawing a list of images which are stored in a table. But ... In example, I add the first img with index 1, layer I will add another img with index 8 and to finish I will add the last img with index 3. The img with the index 8 should be drawn over the index 1 & 2, but sometimes. IDK why, the img with index 2 is over drawing the img with the index 1 & 8. Example Code. Regards.
  24. For example. I want to create a renderTarget which containt a square (dxDrawRectangle) and an image, like a star (dxDrawImage) and apply the gradient shader effect to both of them. to later draw it. However, I wont create just one renderTarget, I want to create multiples of them with different gradient colors. Thats why I asked you if I need to create a shader per renderTarget (which containt the square and the star).
×
×
  • Create New...