
Ace_Gambit
Members-
Posts
569 -
Joined
-
Last visited
Everything posted by Ace_Gambit
-
[REL] Kapil's Instant House Construction - [KIHC 0.1.61]
Ace_Gambit replied to Kapil's topic in Resources
Nvm. I thought you were using the xml files to port read-only configuration settings. -
[REL] Kapil's Instant House Construction - [KIHC 0.1.61]
Ace_Gambit replied to Kapil's topic in Resources
Nvm. I thought you were using the xml files to port read-only configuration settings. -
You could try something like this: oSAM = getElementByID("bla bla") -- SAM site object previousTick = getTickCount() function callbackClientRender() if (testTargetAngleAgainstLoS(oSAM, getLocalPlayer(), 35, 15, 100, 5, 200) and getTickCount() > (previousTick + 1500)) then previousTick = getTickCount() outputChatBox("Uh-oh") -- fire rocket end end addEventHandler("onClientRender", getRootElement(), callbackClientRender)
-
You could try something like this: oSAM = getElementByID("bla bla") -- SAM site objectpreviousTick = getTickCount() function callbackClientRender() if (testTargetAngleAgainstLoS(oSAM, getLocalPlayer(), 35, 15, 100, 5, 200) and getTickCount() > (previousTick + 1500)) then previousTick = getTickCount() outputChatBox("Uh-oh") -- fire rocket endend addEventHandler("onClientRender", getRootElement(), callbackClientRender)
-
pushed away when driving in teleport, pleas help
Ace_Gambit replied to XetaQuake's topic in Scripting
Hi, I has similar problems when teleporting an occupied vehicle. The vehicle would simply catapult into the air after the teleport and burst into flames . What I did afterwards is teleport the vehicle and froze it in position. At the same time a timer would check if the camera was back in position again. When it did the vehicle was unfrozen again and fixed the problem for me in almost all cases. -
pushed away when driving in teleport, pleas help
Ace_Gambit replied to XetaQuake's topic in Scripting
Hi, I has similar problems when teleporting an occupied vehicle. The vehicle would simply catapult into the air after the teleport and burst into flames . What I did afterwards is teleport the vehicle and froze it in position. At the same time a timer would check if the camera was back in position again. When it did the vehicle was unfrozen again and fixed the problem for me in almost all cases. -
I am not a big fan of maths either. In fact I really suck at it but I have some basic understanding of angles and came up with this. function testTargetAngleAgainstLoS(source, target, traceAngle, minDepth, maxDepth, minOffsetZ, maxOffsetZ) local oX, oY, oZ = getElementPosition(source) local rotX, rotY, rotZ = getObjectRotation(source) local tX, tY, tZ = getElementPosition(target) local targetDist2D = getDistanceBetweenPoints2D(oX, oY, tX, tY) local losX, losY, losZ = oX, oY, oZ local btX, btY, btZ = oX, oY, oZ local btDist2D = 0 local pX2D, pY2D = 0, 0 local pDist2D = 0 local ptotDist2D = 0 local angle = 0 if (targetDist2D < minDepth or targetDist2D > maxDepth or tZ < (oZ - minOffsetZ) or tZ > (oZ + maxOffsetZ)) then return end losX = losX - math.sin(math.rad(rotZ)) * targetDist2D losY = losY + math.cos(math.rad(rotZ)) * targetDist2D btX = btX - math.sin(math.rad(rotZ + 180)) * targetDist2D btY = btY + math.cos(math.rad(rotZ + 180)) * targetDist2D btDist2D = getDistanceBetweenPoints2D(btX, btY, tX, tY) if (tX > losX) then pX2D = tX - (math.abs(tX - losX) / 2) else pX2D = losX - (math.abs(losX - tX) / 2) end if (tY > losY) then pY2D = tY - (math.abs(tY - losY) / 2) else pY2D = losY - (math.abs(losY - tY) / 2) end pDist2D = getDistanceBetweenPoints2D(oX, oY, pX2D, pY2D) ptotDist2D = getDistanceBetweenPoints2D(pX2D, pY2D, tX, tY) angle = math.deg(math.tan(ptotDist2D / pDist2D)) * 2 return (angle > 0 and angle < traceAngle and targetDist2D < btDist2D) end What it does is return true if a target is within the field of sight (angle between line of sight and target vector).
-
I am not a big fan of maths either. In fact I really suck at it but I have some basic understanding of angles and came up with this. function testTargetAngleAgainstLoS(source, target, traceAngle, minDepth, maxDepth, minOffsetZ, maxOffsetZ) local oX, oY, oZ = getElementPosition(source) local rotX, rotY, rotZ = getObjectRotation(source) local tX, tY, tZ = getElementPosition(target) local targetDist2D = getDistanceBetweenPoints2D(oX, oY, tX, tY) local losX, losY, losZ = oX, oY, oZ local btX, btY, btZ = oX, oY, oZ local btDist2D = 0 local pX2D, pY2D = 0, 0 local pDist2D = 0 local ptotDist2D = 0 local angle = 0 if (targetDist2D < minDepth or targetDist2D > maxDepth or tZ < (oZ - minOffsetZ) or tZ > (oZ + maxOffsetZ)) then return end losX = losX - math.sin(math.rad(rotZ)) * targetDist2D losY = losY + math.cos(math.rad(rotZ)) * targetDist2D btX = btX - math.sin(math.rad(rotZ + 180)) * targetDist2D btY = btY + math.cos(math.rad(rotZ + 180)) * targetDist2D btDist2D = getDistanceBetweenPoints2D(btX, btY, tX, tY) if (tX > losX) then pX2D = tX - (math.abs(tX - losX) / 2) else pX2D = losX - (math.abs(losX - tX) / 2) end if (tY > losY) then pY2D = tY - (math.abs(tY - losY) / 2) else pY2D = losY - (math.abs(losY - tY) / 2) end pDist2D = getDistanceBetweenPoints2D(oX, oY, pX2D, pY2D) ptotDist2D = getDistanceBetweenPoints2D(pX2D, pY2D, tX, tY) angle = math.deg(math.tan(ptotDist2D / pDist2D)) * 2 return (angle > 0 and angle < traceAngle and targetDist2D < btDist2D)end What it does is return true if a target is within the field of sight (angle between line of sight and target vector).
-
Someone told me they even have the Windows source code .
-
Someone told me they even have the Windows source code .
-
If the vehicle doesn't load then you will have to covert it to SA format. Also when you replace a model all vehicles with the same model ID change as well.
-
If the vehicle doesn't load then you will have to covert it to SA format. Also when you replace a model all vehicles with the same model ID change as well.
-
I don't really understand the part where you say: setElementPosition ( deathSphere, the coordinates ) Is that a typo? Anyway, this is how I would have done it in your case (using the spheres): resourceRoot = getResourceRootElement(getThisResource()) sphereX, sphereY, sphereZ = 1202, 909, 4 -- just some random values offWorldX, offWorldY, offWorldZ = 7000, 7000, 0 -- again, just some random values function enableSam ( ) currentX, currentY, currentZ = getElementPosition(deathSphere) if (currentX == sphereX and currentY == sphereY and currentZ == sphereZ) then setElementPosition ( deathSphere, offWorldX, offWorldY, offWorldZ ) else setElementPosition ( deathSphere, sphereX, sphereY, sphereZ ) end setTimer ( enableSam, 1000, 1 ) end addCommandHandler ( "samon", enableSam ) addEventHandler ( "onResourceStart", resourceRoot, enableSam ) This is just an alternative method. In my latest implementation of SAM sites I am no longer using collision shapes. Instead the SAM site is calculating the angle between the line of sight vector and the target vector. If this is within a certain angle (thus within the field of sight) the SAM is fired.
-
I don't really understand the part where you say: setElementPosition ( deathSphere, the coordinates ) Is that a typo? Anyway, this is how I would have done it in your case (using the spheres): resourceRoot = getResourceRootElement(getThisResource()) sphereX, sphereY, sphereZ = 1202, 909, 4 -- just some random valuesoffWorldX, offWorldY, offWorldZ = 7000, 7000, 0 -- again, just some random values function enableSam ( ) currentX, currentY, currentZ = getElementPosition(deathSphere) if (currentX == sphereX and currentY == sphereY and currentZ == sphereZ) then setElementPosition ( deathSphere, offWorldX, offWorldY, offWorldZ ) else setElementPosition ( deathSphere, sphereX, sphereY, sphereZ ) end setTimer ( enableSam, 1000, 1 )end addCommandHandler ( "samon", enableSam )addEventHandler ( "onResourceStart", resourceRoot, enableSam ) This is just an alternative method. In my latest implementation of SAM sites I am no longer using collision shapes. Instead the SAM site is calculating the angle between the line of sight vector and the target vector. If this is within a certain angle (thus within the field of sight) the SAM is fired.
-
If you know the target location of the moving object then you can check if it has reached its destination. When it does you can start the next move object sequence (and so on). This is probably a better way of doing it because you do not have to write down every single move object call. Also consider loading the paths from a configuration file instead of hard coding it in your script.
-
If you know the target location of the moving object then you can check if it has reached its destination. When it does you can start the next move object sequence (and so on). This is probably a better way of doing it because you do not have to write down every single move object call. Also consider loading the paths from a configuration file instead of hard coding it in your script.
-
Whoops, I edited my post and forgot to paste the link back again. It should be fixed now. And yea, I have been thinking of doing it that way (updating with the server every few seconds) but left it out for some reason. But maybe I'll do that later on.
-
Whoops, I edited my post and forgot to paste the link back again. It should be fixed now. And yea, I have been thinking of doing it that way (updating with the server every few seconds) but left it out for some reason. But maybe I'll do that later on.
-
The errors in samsite and samwarn are probably caused because onColShapeHit returns the element that hit the shape as an parameter. This can be a player or a vehicle. When you are in a vehicle the call back does a check on the vehicle as well. This is a better way of scripting it: function samSite ( element, matchingDimension ) if (getElementType(element) == "player") then ... end end function samWarn ( element, matchingDimension ) if (getElementType(element) == "player") then ... end end The second part where you are trying to make a flying samsite is not working because of the reason mentioned above. It will throw an error and stop executing. Instead you should check if the element is indeed a player. function samready ( element, matchingDimension ) if (getElementType(element) == "player") then veh = getPlayerOccupiedVehicle ( element) id = getVehicleID ( veh ) if ( id == 511 ) then triggerClientEvent ( element, "blastem", getRootElement() ) outputChatBox ( "here it comes", element, 255, 0, 0 ) end end end The third part is not working because player is not defined (at least not in your code). function samTrigger ( thePlayer ) ... local hitx, hity, hitz = getElementPosition ( thePlayer ) ... end
-
The errors in samsite and samwarn are probably caused because onColShapeHit returns the element that hit the shape as an parameter. This can be a player or a vehicle. When you are in a vehicle the call back does a check on the vehicle as well. This is a better way of scripting it: function samSite ( element, matchingDimension ) if (getElementType(element) == "player") then ... endend function samWarn ( element, matchingDimension ) if (getElementType(element) == "player") then ... endend The second part where you are trying to make a flying samsite is not working because of the reason mentioned above. It will throw an error and stop executing. Instead you should check if the element is indeed a player. function samready ( element, matchingDimension ) if (getElementType(element) == "player") then veh = getPlayerOccupiedVehicle ( element) id = getVehicleID ( veh ) if ( id == 511 ) then triggerClientEvent ( element, "blastem", getRootElement() ) outputChatBox ( "here it comes", element, 255, 0, 0 ) end end end The third part is not working because player is not defined (at least not in your code). function samTrigger ( thePlayer ) ... local hitx, hity, hitz = getElementPosition ( thePlayer ) ... end
-
ill pay u 9999999999999$ if u'll modeling liberty city (gta3) There's no need to do that. You can export dff files from the gta3.img and import them into 3ds max for example and convert them to sa.
-
ill pay u 9999999999999$ if u'll modeling liberty city (gta3) There's no need to do that. You can export dff files from the gta3.img and import them into 3ds max for example and convert them to sa.
-
Drag and Drop 1.1 resource for MTA:SA DM DP2 by Ace_Gambit This resource allows you to drag and drop MTA elements almost like in the MTA Race editor. You can run this resource as part of your own script or stand-alone. Features: - Old style drag and dropping of MTA elements - Supports objects and vehicles (possibly even pickups but hasn't been tested) - Free movement when cursor is hidden - Rotate elements over x and z-axis Download: https://community.multitheftauto.com/index.php?p= ... ils&id=137 Version 1.1: - Added ability to rotate elements! - Added world rotation of selected element (toggle with F2) - Fixed README (missing controls and typo's) Usage: Drop the archive in your resource folder and start it. The original distribution is designed to run as stand-alone. This means that you can run it parallel to your favourite map editor resource. In stand-alone modus players are automatically registered as editors. In order to run this resource as part of your own script you must edit the meta.xml. Change the "runstandalone" setting (meta.xml) to "false". The resource will not register newly joined players as editors anymore. You will have to do it in your script instead using one of the following export functions. Exports: - regPlayerAsEditor(element player) - unregPlayerAsEditor Controls: - F1 toggles drag and drop mode on (requires the cursor to be visible!) or off * - F2 toggles world position/rotation of the selected element - Mouse1 selects an MTA element (press Mouse1 again to drop the MTA element) - LSHIFT (hold) snaps the selected MTA element to the world or any object beneath - F3 toggles rotation controls on or off Rotation: ** - Mouse2 (hold) + Arrow left/right smoothly rotates the element over the x-axis - Mouse2 (hold) + Arrow down/up smoothly rotates the element over the z-axis - Scroll up/down fast rotation over the z-axis - LCTRL (hold) + Scroll up/down fast rotation over the x-axis - SPACE resets the element to its default rotation The dragging is pretty straight forward. Just move your mouse to anywhere on the screen. Free movement: This resource supports dragging without the cursor being visible. This comes in handy if you want to move the object high into the air with a jetpack or something. As long as drag and drop mode is enabled you can toggle the cursor on and off. It has to be visible when you want to select a new MTA element though. Note: When you select a vehicle all passengers are thrown out. This is to prevent bugs when the client script is temporary disabling the element's collision. Also be aware that other players can not select the same MTA element or see an element being moved by a remote player. The MTA element is synchronized again when the remote player drops it. * When drag and drop is enabled a yellow corona and red arrow appear. ** In order to prevent interference with running resources the rotation controls are toggable (F3). Credits to the MTA team
-
Drag and Drop 1.1 resource for MTA:SA DM DP2 by Ace_Gambit This resource allows you to drag and drop MTA elements almost like in the MTA Race editor. You can run this resource as part of your own script or stand-alone. Features: - Old style drag and dropping of MTA elements - Supports objects and vehicles (possibly even pickups but hasn't been tested) - Free movement when cursor is hidden - Rotate elements over x and z-axis Download: https://community.multitheftauto.com/index.php?p= ... ils&id=137 Version 1.1: - Added ability to rotate elements! - Added world rotation of selected element (toggle with F2) - Fixed README (missing controls and typo's) Usage: Drop the archive in your resource folder and start it. The original distribution is designed to run as stand-alone. This means that you can run it parallel to your favourite map editor resource. In stand-alone modus players are automatically registered as editors. In order to run this resource as part of your own script you must edit the meta.xml. Change the "runstandalone" setting (meta.xml) to "false". The resource will not register newly joined players as editors anymore. You will have to do it in your script instead using one of the following export functions. Exports: - regPlayerAsEditor(element player) - unregPlayerAsEditor Controls: - F1 toggles drag and drop mode on (requires the cursor to be visible!) or off * - F2 toggles world position/rotation of the selected element - Mouse1 selects an MTA element (press Mouse1 again to drop the MTA element) - LSHIFT (hold) snaps the selected MTA element to the world or any object beneath - F3 toggles rotation controls on or off Rotation: ** - Mouse2 (hold) + Arrow left/right smoothly rotates the element over the x-axis - Mouse2 (hold) + Arrow down/up smoothly rotates the element over the z-axis - Scroll up/down fast rotation over the z-axis - LCTRL (hold) + Scroll up/down fast rotation over the x-axis - SPACE resets the element to its default rotation The dragging is pretty straight forward. Just move your mouse to anywhere on the screen. Free movement: This resource supports dragging without the cursor being visible. This comes in handy if you want to move the object high into the air with a jetpack or something. As long as drag and drop mode is enabled you can toggle the cursor on and off. It has to be visible when you want to select a new MTA element though. Note: When you select a vehicle all passengers are thrown out. This is to prevent bugs when the client script is temporary disabling the element's collision. Also be aware that other players can not select the same MTA element or see an element being moved by a remote player. The MTA element is synchronized again when the remote player drops it. * When drag and drop is enabled a yellow corona and red arrow appear. ** In order to prevent interference with running resources the rotation controls are toggable (F3). Credits to the MTA team
-
The script above is actually written by Vercetti1010 and not by me . I am kind of busy creating something. But I'll have a look at it when I'm done.