Jump to content

Gallardo9944

Members
  • Posts

    442
  • Joined

  • Last visited

Everything posted by Gallardo9944

  1. Hello. I bet you have faced some issues with dxDraw* functions, especially with some situations when you have to use your FPS as a counter of *something* like movement of images or texts. You could use average FPS counted each per second and go nicely with it, but the drawing still won't be precise. So, I have decided to share a little FPS formular for developers who need more exact FPS information (basically, each frame). Here goes the code: local d = false local t1 = 0 local FPS = 0 function fpsCount() if d == true then local t2 = getTickCount() local diff = t2-t1 local ctr = 1000/diff FPS = ctr t1 = getTickCount() else t1 = getTickCount() d = true end end addEventHandler("onClientRender",getRootElement(),fpsCount) How it works: We have a variable "d", which basically is changed after one frame, so that specifies whether we have the first tick counter or not. I don't use onClientPreRender together with that as far as it's not gonna be precise. Then, after it is changed, and if it equals to boolean false, we get current tick counter. This is our first state of time before the new frame starts. Then, "d" is changed once again, and it's boolean true now, so we get another tick counter and find the difference between the second and the first states. This is the difference between the previous frame and the current one, basically the time when one frame passes. Then it's easy to find the frames per second counter by dividing one second (1000ms) by our frame difference. That is our EXACT fps at the moment of time, no matter what happens. The value is float, so we have to use math.ceil or math.floor to get it as an integer, to output somewhere, if you need that. Thanks for reading! The thread was made to provide a better formular for those, who need exact fps information. I know the code is amazingly easy, but still, would be useful for those, who don't want to reinvent the wheel.
  2. Free to download now: http://er-mta.tk/index.php/topic,159.0.html
  3. function doSomething() for i=0, 1000000 do print("Did!") end end function doAnother() print("Did!") end doSomething() doAnother()
  4. destructionderby.lua - find functions with raceMode.end() and then edit conditions to check for 0, not 1.
  5. you might add onClientGUIClick to your grid list, not to your row.
  6. What's the problem? Tables and loops for all the players won't cause any CPU/RAM consumption, so it won't provide any lag.
  7. save your data at MySQL database and then read it from your site. dbConnect() dbQuery() These functions will help you.
  8. for i,v in ipairs(table) do i = iteration number v = value of the table, it equals table for v in pairs(table) do v = value of the table. You can't get the iteration number here.
  9. Hello. I have a code with a moving camera but, when the camera moves, and the players rotates, the camera has still the same its fixed rotation. Yes, it must be like that, but i want it to rotate camera when the player is rotating too. Is there any way i can do that? Thanks in advance.
  10. Hello, guys. Wine (Basically, with front-end PlayOnLinux) is running GTA and, of course, MTA pretty well, but, after the upgrade to the latest patch (as soon as MTA asked me 1 week ago), it doesn't wanna start. POL debugger says nothing, Wine just returns 'The application has closed unexpectedly'. After the installation of older version (Previous 1.3.1 installer), it works fine. Is there any way to make MTA with latest patch run on Linux?
×
×
  • Create New...