Jump to content

Dealman

Members
  • Posts

    1,421
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Dealman

  1. Try to store it as a local variable at the top of the script instead, like this; local sound = nil; function exampleCode() if(true == false and false ~= true) then sound = playSound("File.mp3") end end
  2. So long as it's local to the function and he's stopping it within the function it should be fine to use local.
  3. Ah, that makes more sense then Could you make something for us muscle car enthusiasts?
  4. If you look at around 0:29 on your video, the car keeps accelerating when it's at 8k, that's shouldn't really be happening What about adding a rev-limiter?
  5. Sounds much better now, but there's still some work needed with the tachometer. Even at full RPM it sounds/seems like the car is still accelerating a fair bit. Do you think you could emulate the way torque works? For example, most cars will have their peak torque at around 4 000 - 6 000 RPM, after that the torque will begin to drop - accelerating much slower. Other than that it looks really promising, and will add a whole new level of immersion to MTA. Great job!
  6. Every day immaturity seem to reach new levels...
  7. Dealman

    DX.GUI

    How is it lazy to use a tool that gives you visual feedback on the fly? It's basically a What You See Is What You Get. It's not being lazy, it's called saving time. @Ivan: You don't start it. The resource comes with exported functions to create DX drawn elements such as windows and buttons. All you have to do is have the resource running in the background, and then you can use the exported functions in your own resource to draw stuff. It's all explained on its wiki page.
  8. Doubt it, it is rather pathetic whether you're the co-owner or not...
  9. I do use resourceRoot instead, but I do write getRootElement. And if it bothers you, I really don't care - every programmer has their own way of doing things. A frame at 60 FPS is ~16.6ms. 13ms isn't even the duration of a frame. That's how small of in impact it is after looping it 10 000 times. Regarding the glass of water, it's a proverb. Look up what that means, albeit I'll admit it was a poor one. Also, I'd rather stop arguing about this since we're just hi-jacking the poor guy's thread and we might just end up getting a moderator to lock it. But if you honestly think it's ever-so important to use root instead, by all means.
  10. Of course a good programmer always work to further optimize their creations, but in what circumstance would you make a for loop, that executes 10 000 times - doing nothing of importance? Other than to solely check the time to execute. His example was to prove that there IS a difference, but the point is - it's no-where near a noticable difference of any sort. If you honestly think that using root instead of getRootElement is better, you're just a try-hard. As I mentioned, I'm used to writing getRootElement and I will keep doing so because I know that it won't ever impact the performance of my scripts. It's like if you were trying to engulf the entire world in water by pouring a glass of water into the ocean.
  11. Int is never properly defined as an integer. You must be using the command wrong. Are you converting it from a string to a number as well?
  12. Maybe this would help you; guiLabelGetTextExtent
  13. ...How exactly doesn't it make sense? I also write getRootElement instead of root. Simply because it's what I'm used to and it has absolutely no performance impact whatsoever. His other statement is also true that he made a resource and is trying to get better at it. So in all honesty, your reply made no sense.
  14. We can't help you if you won't post enough relevant code to help you. We're, well at least not I am gonna sit here and play some sort of guessing game. If you're scared it might be 'stolen', go ahead and PM me instead.
  15. Nothing is wrong with it. How are you triggering the event onLevelHundred
  16. Rather confused as to what you want, but is it something like this you need? function drawLevelHundredImage_Handler() dxDrawImage(screenWidth/3.25, screenHeight/1.045, 32, 32, '1.png', 0, -120) end function onClientLevelHundred_Handler() addEventHandler("onClientRender", getRootElement(), drawLevelHundredImage_Handler) -- Only start drawing when the event "onLevelHundred" is triggered. end addEvent("onLevelHundred", true) addEventHandler("onLevelHundred", root, onClientLevelHundred_Handler)
  17. What do you mean? I've made a script which gives your vehicle a significant boost if you do a burnout, if that's what you're after.
  18. You can read the Meta.xml with the xml functions
  19. Post your current code and read about setPedAnimation thoroughly.
  20. Here's a bit overly complicated way of doing it, so I'll just quote myself. There are some easier ways of doing it, of course. But this might be able to help you get on your feet, and make it yourself - there's no better way of learning than that.
  21. How exactly do you want to use this...? It would help significantly to write it for you... Edit: Here's an example of how you can do it, with the script below you can execute a command like this one; "/cvn 411" - this will check if it exists in the table with custom names - if not, it will get the default vehicle name. Example, 579 will return "Huntley". I just wrote this up out of my head, so there might be some mistake somewhere, but the table check should work. Also I'm not sure what the results are if you try to check an ID like 6000. Assuming it will return false, or nil. Client-Side;
  22. You can certainly make use of tables if you so desire, this is how I'd make it. This is purely an example; First you can define the entries into an array like this; local vehicleData = {579, 60000, "AWD", 0.8151, 0.8151, 0.01, 0.1, 952}, {400, 60000, "AWD", 0.8151, 0.8151, 0.01, 0.1, 952} You can then call either of these entries as you please, by using a method like this; outputChatBox("Drivetrain: "..vehicleData[1][3]); outputChatBox("Max Velocity: "..tostring(vehicleData[1][8])); Or you could do as MADE suggested. Whichever you find to be the most convenient to do.
  23. Google "lua tables" and "lua for loop". Read about how they work, and then try it yourself. There's no better way of learning than by trial and error.
  24. Good job, am glad to see another person supporting open source releases
×
×
  • Create New...