Jump to content

Dealman

Members
  • Posts

    1,421
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Dealman

  1. You only need to insert a new table, the rest should be automatic. The command can be whatever you'd like. For example; local gateTable = { {"Gate1", 3084, 2361, -1272, 24.6, 0, 0, 90, 2361, -1272, 21, 0, 0, 90, 3000, false}, {"Gate2" ...}, ["Gatorade", ...} };
  2. You can download the 3ds Max script here(I did not upload these!). Then what you do is use IMG Tool to extract the cheetah.dff from gta3.img. Then you import it into 3ds Max using the above scripts. Once you've managed to import it successfully you just move the exhuast dummies around, you can also create new ones; exhaust and exhaust2. There's also a flag you might have to change for a vehicle to get double exhausts to work. I'd suggest you use the Handling Editor to test that. I've uploaded the .dff here if you want to check it out. Edit: Oh and to export it, you select everything in the scene and check the "Vehicle Parts" box and then export it to your desired location!
  3. You could do something like this with tables, I just wrote this a bit fast so you'll probably have to adjust it a bit to fit your needs. Of course it would be easier to create a new function and command for every gate, and allow for more precise control of each gate. This is but an example of how you could do it using tables. --{"Command", ModelID, Closed PosX, Closed PosY, Closed PosZ, Closed RotX, Closed RotY, Closed RotZ, Open PosX, Open PosY, Open PosZ, Open RotX, Open RotY, Open RotZ, MoveTime, theState} local gateTable = { -- Just add your gates here using the syntax above. Put a , after each array except for the last one. {"Gate1", 3084, 2361, -1272, 24.6, 0, 0, 90, 2361, -1272, 21, 0, 0, 90, 3000, false} }; function createGates_Handler() for k, v in ipairs(gateTable) do local a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 = unpack(v); local theGate = createObject(a2, a3, a4, a5, a6, a7, a8); addCommandHandler(a1, function() local a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 = unpack(v); if(a16 == false) then moveObject(theGate, a15, a9, a10, a11, a12, a13, 0) table.remove(v, 16) table.insert(v, 16, true) outputChatBox("Opened Gate!") else moveObject(theGate, a15, a3, a4, a5, a6, a7, 0) table.remove(v, 16) table.insert(v, 16, false) outputChatBox("Closed Gate!") end end); end end addEventHandler("onClientResourceStart", resourceRoot, createGates_Handler)
  4. Not entirely sure if you can change the exhaust position with setVehicleComponentPosition 'cause I've never used it. If you can't then the answer would be the .dff model. I can help you with that if needed. Edit: Since I don't whether you're using a customized model or not, I'm not exactly sure where you want this. But an example; I use 3ds Max 2015 for any modeling I do, that includes models for MTA.
  5. Dealman

    Vehicle aim

    I'd assume you should be able to calculate it using getVehicleTurretPosition perhaps?
  6. Do you mean as in doing donuts or a barrel roll? If you mean doing a barrel roll, you'll want to look into setVehicleTurnVelocity.
  7. I believe you misunderstood the arguments of moveObject, as where you should have entered the time it would take the object to move from Point A to Point B - you had entered your X co-ordinate instead. Do you need something like this? local isGate1Opened = false function createGates_Handler() myGate1 = createObject(3084, 2361, -1272, 24.60000038147, 0, 0, 90) end addEventHandler("onResourceStart", resourceRoot, createGates_Handler) function openGates_Handler() if(isGate1Opened == false) then moveObject(myGate1, 3000, 2361, -1272, 21) isGate1Opened = true else moveObject(myGate1, 3000, 2361, -1272, 24.60000038147) isGate1Opened = false end end addCommandHandler("gate1", openGates_Handler) If you're going to add a lot of gates, you'll want to use tables.
  8. Dealman

    Marker script

    You want to change the vehicle's handling if it hits a marker? In that case; onMarkerHit setVehicleHandling
  9. Deepu, I think you should look at your own behaviour on these forums before you jump at others. You claiming that Woovie behaves rude is just hypocritical. Majority of your posts that I have read, you've always gotten into a fight with one another, you always take things as an offense, and you always need to defend yourself for some reason. Either way, I'd say this has been derailed enough, so lets stay on topic?
  10. Al3grab, Woovie simply stated the camera angles are nauseating, which is true. It's called feedback, neither of what he said was or should be considered offensive(or asshol-ish as you seem to call it). If anything, it was feedback. If you can't take criticism without going completely crazy, you should not publicly release your resources like this. Nauseating things are a big issue for some people, just because you might not find it nauseating does not mean others will not. And there will always be feedback, both positive and negative - no matter where or what you release. He never stated that it looked bad or anything, just that the resource has odd camera angles. So chillax bud
  11. You already have the ability to implement things into MTA using their Module system, it uses C++. Hell, you could probably implement Oculus Rift to MTA using their module system.
  12. That's MTA's API, not really Lua per se. So, really, Hello World would simply look like this; function helloWorld() print("Hello World"); end The semi-colon aren't necessarily needed, no. But it's still good practice to use it since they indicate the end of a statement. They're still very useful should you need to execute several statements on a single line, or simply for more effiecent code(though, probably won't have a noticeable impact). It's especially good if you plan to code in more than one language @SEV3NS: If you search you should find a lot of threads about how to make a script for moving gates. I'm pretty sure there's quite a few resources up on the community as well.
  13. There's no need to go that far over-the-top for such a simple thing, just use a variable - simple. local isMapInfoActive = false; function mapInfo_Handler() if(isMapInfoActive == false) then addEventHandler("onClientRender", root, MapInfo); isMapInfoActive = true; else removeEventHandler("onClientRender", root, MapInfo); isMapInfoActive = false; end end addCommandHandler("TurnOffMapInfo", mapInfo_Handler, false); -- False means it will not be case-sensitive bindKey("F3", "down", mapInfo_Handler);
  14. No, no, Woovie. We can't have that, nowadays things have to be swag yolo snapback, you know?
  15. I think you're misunderstanding the concept of Modules. You can't just execute C++ in MTA like that. You need to create your own module, in C++, and compile it as a .dll file for it to be used with MTA. I suggest you download the Module SDK and take a look at it, to get an idea how it works. Edit: No scripting language would run that loop. The ; at the end of for is not valid in any language. Also no logic would touch the script, even if there weren't syntax errors. Health as a variable has already been set, so whatever it's at isn't going to change during the loop, and nothing runs alongside for loops like this unless you have some multi-threaded module, which you don't, so unless you had a class set as health that returned an updated health whenever it was called, which you just don't, that's another failure on your part. Every language has an opening structure and closing structure, for LUA it's then/do and end respectively, for most others it's { and }. You have no "do", which is the correct method for opening a code segment after for, and basically the opposite of ";" which is used to end a code statement. Also you specify that the health increases but the loop only checks to see if a value is already at or over 50 before running, ie, it would run infinitely. Finally LUA doesn't allow the final argument in for to be any basic code, it's already an int/float that will be added every step of the for loop, so - TL;DR: You did loads of things wrong with that, things that someone who knows any language would know not to do. for (i=0;getElementHealth(woundedPlayer)<50;1) do setElementHealth(woundedPlayer, i); end Would check if the player has under 50 health, and if so increment 1 at a time until they were at 50.
  16. Haha, you're always so defensive, Deepu. You already have all the functions you need to create a 3D-like DX menu, would it be easy? No. I simply said it's possible. If you do know math as well as you claim, why don't you go ahead and do it yourself then? Yes, you can use C++, MTA's module system uses C++.
  17. You know, you can just create your own function for that...
  18. Managed to find the issue after a while, turns out Node Attributes may not have spaces in them. Rookie mistake IE; Example Attribute = "Value"
  19. Been working on a new resource for my project, and now it seems I can't use xmlLoadFile anymore. Is anyone else having this issue? I have a resource I made before, which created an XML file to save settings - it has worked perfectly fine until now, since now it can't load XML file either. I can edit an XML file directly after it's created, but if I unload it and try to load it again - it returns false. I went to the folder where it saves the client-side XML and it's there, I can literally see it lying there - all innocent. But I simply can't load it at all. Any suggestions? Edit: I have tried to delete all the cached files several times, makes absolutely 0 difference.
  20. Since I've been working a lot with DX drawings as of lately, simply because CEGUI looks like complete arse - I've always thought it's a very slow and gruesome task. Especially since if you use GUI Editor like I do, you'll then have to edit it to make it relative to fit all resolutions. This takes especially long if you have rectangles and text drawings which are outlined(not to mention outlining transparent rectangles doesn't quite work with GUI Editor because it creates several boxes, instead of lines which this code uses), so to save some time - I've written 2 very basic functions to make it look less cluttery and easier to work with. Just to provide an example, what I'm working on consisted of 53 lines of code for all the rectangles, lines and texts. I managed to reduce that down to 15 using those functions - saving a considerable amount of my time. I thought I'd post this here since I don't know if those are considered Wiki material, they're very basic and doesn't really have any error messaging or anything of that sort. UtilityFunctions.lua (You can name it whatever you want, but I always keep a separate file for utility functions such as these) Syntax Example: local sX, sY = guiGetScreenSize(); function drawExampleCode_Handler() dxDrawOutlinedRectangle(1, tocolor(255, 255, 255, 255), sX/2-50, sY/2-50, 150, 150, tocolor(187, 0, 0, 80), false, false); dxDrawOutlinedText(tocolor(0, 0, 0, 255), "Username", sX/2-55, sY/2-280, sX/2+150, sY/2+150, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "center", false, false, false, false, false); end addEventHandler("onClientRender", root, drawExampleCode_Handler); The above example would normally be 10 lines of code(4 lines for outline, 1 for the fill) - but is now instead just 2 lines. Edit: I'll also go ahead and quote a reply I made a while ago, where I explained how I (somewhat automatically?) convert my DX stuff to relative. Remember to edit it to so it uses the same screen size variables as you do! (screenX + screenY) Edit 2: I also made one for creating a Rectangle with a title frame at top. Here's an example; function dxDrawOutlinedRectangleWithTitle(outlineThickness, outlineColour, titleFrameHeight, titleText, posX, posY, sizeX, sizeY, fillColour, postGUI, pixelPos) dxDrawRectangle(posX, posY, sizeX, sizeY, fillColour, postGUI, pixelPos); -- Rectangle dxDrawLine(posX, posY, posX+sizeX, posY, outlineColour, outlineThickness, postGUI); -- Top Line dxDrawLine(posX, posY+titleFrameHeight, posX+sizeX, posY+titleFrameHeight, outlineColour, outlineThickness, postGUI); dxDrawLine(posX, posY+sizeY, posX+sizeX, posY+sizeY, outlineColour, outlineThickness, postGUI); -- Bottom Line dxDrawLine(posX, posY, posX, posY+sizeY, outlineColour, outlineThickness, postGUI); -- Left Line dxDrawLine(posX+sizeX, posY, posX+sizeX, posY+sizeY, outlineColour, outlineThickness, postGUI); -- Right Line dxDrawText(titleText, posX, posY, sizeX+(sizeX/2), sizeY+(sizeY/2), tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top"); end local sX, sY = guiGetScreenSize(); function drawExampleCode_Handler() dxDrawOutlinedRectangleWithTitle(1, tocolor(255, 255, 255, 255), 30, "Test Window", 250, 250, 500, 500, tocolor(0, 0, 0, 80), false, false); end addEventHandler("onClientRender", root, drawExampleCode_Handler); But it's not really optimal to work with, and I'd rather just use the text itself and create a line manually. But it's there if you want to improve upon it...
  21. Ehm... Have you even tried this? The reason for the FPS drop is not solely the size of the render target nor his GPU. But due to the fact that you have to switch the camera matrix every consecutive frame. Frame 1 = Camera Matrix 1 Frame 2 = Camera Matrix 2 Frame 3 = Camera MAtrix 1 Frame 4 = Camera Matrix 2 (Then repeat this procedure 60 times a second, and you'll have 2 different sources at 30 FPS) Since you'll have to do this, you're basically cutting your effective FPS in half. If you play at a stable 60 FPS - 30 FPS will be spent on Camera Matrix 1 and 30 FPS on Camera Matrix 2. This is the only solution I know of. If you know another one which apparently has no performance impact - please, do enlighten us
  22. Well aren't you one to talk, you sexy beast
×
×
  • Create New...