• Content count

  • Joined

  • Last visited

  • Days Won


quindo last won the day on August 30

quindo had the most liked content!

Community Reputation

10 Decent

1 Follower

About quindo

  • Rank

Recent Profile Visitors

514 profile views
  1. A couple questions about memory usage

    1. There are issues with mta vram/ram management when it comes to graphical components like shaders or textures which may cause them to fail to create even when there's lots of memory still available theoretically. 2. Stuff like dxDrawImage don't stay in memory, they are queued to draw in current frame, and cease to exist afterwards. Textures used by them are stored in memory only. 3. No idea.
  2. [QUESTION] Different types of 'for' loops.

    There's also this pretty useful page: https://springrts.com/wiki/Lua_Performance Where you can see in test 9, that using for i-1, #table is more than 2 times faster than using ipairs. In reality you shouldn't bother with such micro optimizations if you aren't traversing tables with thousands of elements pretty often. The page can be pretty useful if you want to read more about lua optimization quirks tho.
  3. [HELP] Having trouble with "else/if"

    Where are you defining "vehicle"? Iin my script it's theVehicle.
  4. [HELP] Having trouble with "else/if"

    First thing first, onMarkerHit needs marker element instead of root element as second argument if you want to start the function only in certain marker, check it there: https://wiki.multitheftauto.com/wiki/OnMarkerHit And about the code, this should work, i haven't tested it, but you can see how it could be done: local marker1 = createMarker(2063.5, -1831.1999511719, 13, "cylinder",6,225,225,255,20) function repairVehicle ( thePlayer, matchingDimension) setTimer ( function() if thePlayer ~= localPlayer then return end local theVehicle = getPedOccupiedVehicle( thePlayer ) if not theVehicle then return outputChatBox( "You're not in a vehicle!", thePlayer, 200, 0, 0 ) end local vehHealth = getElementHealth( theVehicle ) if vehHealth >= 999 then return outputChatBox( "Your vehicle isn't damaged!", thePlayer, 200, 0, 0 ) end local money = getPlayerMoney( thePlayer ) if money >= 200 then local fixVeh = fixVehicle( theVehicle ) if fixVeh then takePlayerMoney( thePlayer, 200 ) return outputChatBox ("Your vehicle is restored.", thePlayer, 0, 200, 0 ) else return outputChatBox ( "Failed to fix your vehicle.", thePlayer) end end end, 5000, 1) end addEventHandler("onMarkerHit", marker1, repairVehicle)
  5. Looking at the wiki page of AttachElements you can see that only certain types of elements can be attached, the list doesn't include effects so it's safe to say that it can't be attached. There's this: https://wiki.multitheftauto.com/wiki/AttachEffect useful function, try it
  6. [Question] What's been plaguing me

    local gate1 = createObject(968, 1544.6999511719, -1623.9000244141, 13, 0, 89.1, 270) local marker1 = createMarker(1544.5, -1628, 13.5, "cylinder",6,225,225,255,25) local isMoving = false local moveTime = 2000 function moveToll(player) if isMoving then return end if source == marker1 then local move = moveObject(gate1, moveTime, 1544.6999511719, -1623.9000244141, 13, 0, -89.1, 0) if move then isMoving = true setTimer(gate2, 4000, 1, true) end end end addEventHandler("onClientMarkerHit", root, moveToll) function gate2() moveObject(gate1, moveTime, 1544.6999511719, -1623.9000244141, 13, 0, 89.1, 0) setTimer(function() isMoving = false end, moveTime, 1) end As for second problem, this should work, i haven't tested it, but you can see how this could be done. You have to save the current movement state in variable, and move the barrier only if it isn't already moving. You cant use moveObject as condition because it's function, it's gonna always return true. You can see that i save function result in variable "move" and check it in if afterwards. The variable "isMoving" is saving current state of movement. the statement "if isMoving then return end" makes it so the function doesn't start if the barrier is currently moving.
  7. Timer to Progress

    Save timer start tick to some variable, and get remaining time using getTimerDetails, from that you can calculate progress.
  8. I'm gonna send you the logs from MTADiag through private message because some players don't want it to be shown publicly here.
  9. Hey, i wanted to try and use MTADiag on my own pc before sending it out to players and it returned "https://pastebin.mtasa.com/ <head><title>413 Request Entity Too Large</title></head> <body bgcolor="white"> <center><h1>413 Request Entity Too Large</h1></center> <hr><center>nginx</center> </body> </html>" I don't want to start asking players to run this while it's not certain that they will get the results, could you please check that out? I'm gonna wait with MTADiag until the reply, for now i have one more idea what may be causing that, but for that i need to explain a bit what we use those shaders for. Basically on our server we have cars paint jobs system, which plays a huge role in game play, we allow players to customize the cars paint by giving them ability to create their own paint jobs using layered images. The first time a vehicle is streamed, it's paint job must be generated into texture to use and cache it on player HDD, we do it by using rendertarget, drawing the entire paint job on this, and after that using dxGetTexturePixels and dxCreateTexture to save and use it. It may not seem at all related to shaders but lately we released standalone application that can act as rendertarget separate from mta, and we communicate with it using lua and files in our resources. (Released this because dxGetTexturePixels can take up to 1/4 second, which is pretty bad when it can happen at every vehicle stream in). It outputs ready dxt texture that we have just to load from file, we found out that players that use this application don't seem to be affected by the error in the post title at all. It's still only small percent of overall player base that uses this, but we started recommending this as a way to fight this error.
  10. First thing first: I'm not sure if I've chosen proper sub-forum for this, so if it isn't right place then please move it. I'm writing this because we have pretty game-breaking problem on our server that we can't find a way to fix on our side. The shaders randomly fail to create with warning specified in the title, it's happening more and more as our server gets bigger. We do track how often this error/warning happens for our players, and it's in thousands per day. It doesn't happen to all players, but when it happens we can't find any correlation to PC hardware. It happened on new high end pc's and on older hardware. The amount of memory used by MTA as shown in /showmemstat varies too, it's usually not even close to 3.5 gb limit, pretty often around 2gb. We did track, used/available VRAM by collecting data from dxGetStatus when the error happens, and usual there's lots of VRAM left too. Some example numbers here (free video memory for MTA / Total VRAM): 602/1024 2968/4084 It shows that there's enough RAM/VRAM available for MTA that it shouldn't be problem. The full error message also includes the path to shader and file/line. I looked over MTA sourcecode, and found that it fails at call to winapi, the returned HRESULT (8007000e) is E_OUTOFMEMORY which may happen if the memory couldn't be allocated, based on that we think it may be problem with MTA memory management. Some more thoughts: Once a single shader fails to create, all shaders fail to create after that (from what we observed) Our server is pretty big, the issue affects a lot of players but happens seemingly randomly. Some players aren't affected by this at all. I can't reproduce this on local server, neither by playing nor by forcing MTA to create a hundreds of thousands of shaders/textures and deleting them. We're also getting errors with HRESULT code 80070008, but it happens way less than the title error, it looks like that (happens with other shaders too): "[D3DXCreateEffectFromFile failed (80070008)[Loaded 'ngui-r\r.fx' (6737 bytes)]] @ 'dxCreateShader' [r.fx]" In last 16 hours this error happened more than 5300 times on our server, we limit the number of reported errors to 15 per player per session, based on that we can see it happened to a lot of players. Only way to fix this issue is to RESTART MTA, reconnect may help for few minutes but it fails quickly afterwards again. We would love any help with handling this issue, it's limiting our ability to work on server updates as our server relies heavily on shaders.
  11. getplayerAccountBySerial

    function GetAccountNameFromSerial(player, serial) local accounts = getAccountsBySerial(serial) if accounts then for _,v in pairs(accounts) do outputChatBox(getAccountName(v)) end end end addCommandHandler("tes",GetAccountNameFromSerial)
  12. getplayerAccountBySerial

    I can't understand what do you want exactly. You want to give function serial and get back account names? That's what my script does.
  13. getplayerAccountBySerial

    function GetAccountNameFromSerial(serial) local accounts = getAccountsBySerial(serial) if accounts then for _,v in pairs(accounts) do outputChatBox(getAccountName(v)) end end end Something like that should work.
  14. [Free] MTA: DayZ Backup System v1.6

    Just to let you know, your download link shows up like that: That's probably why most people don't know where the download is, same thing happens to image in your signature.
  15. [SHADER] Displacement shader in MTA

    I don't think it is possible to address individual vertices from shaders in mta, at least i haven't found a way to do that.