Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/12/20 in all areas

  1. A database would use more CPU than just a plain file. When using a timeout (as Addlibs said), you can separate the database thread from the MTA thread. When having multiple CPU cores in your VPS server. Your CPU can automatic assign both threads to different cores, which leads to a very low impact on the performance. As for the file, MTA doesn't write directly to the hard drive, there is a buffer in between. Read more about flushing the buffer here. (Note: You shouldn't flush log files without reason) There is no big penalty here either. Very simple writing to a log file: local hFile = fileOpen("test.txt") -- attempt to open the file (read and write mode) if hFile then -- check if it was successfully opened fileSetPos( hFile, fileGetSize( hFile ) ) -- move position to the end of the file fileWrite(hFile, "hello" ) -- append data fileFlush(hFile) -- Flush the appended data into the file. fileClose(hFile) -- close the file once we're done with it else outputConsole("Unable to open test.txt") end -- https://wiki.multitheftauto.com/wiki/FileOpen And the downside of plain file has explained Addlibs already: Accessibility. XML? That is not a good idea for infinity data. XML uses a node system, each node representing a data-location in the XML tree, when you load the file, you load also all the nodes in to the memory. Loading the file should take longer based on the amount of nodes.
    1 point
  2. function isMouseInPosition ( x, y, width, height ) -- Função útil. Serve pra verificar se o mouse está dentro de determinada área ou não. if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) ) end addEventHandler ("onClientRender", root, function () dxDrawImage (x*400, y*100, x*233, y*214, "teste.png", 0, 0, 0, (isMouseInPosition (x*400, y*100, x*233, y*214) and tocolor (255, 255, 255, 240) or tocolor (255, 255, 255, 100))) end) -- O alpha do botão ficará em 240 quando o mouse estiver em cima da imagem e 100 quando não estiver.
    1 point
  3. What is your MTA version? You can check it by writing "ver" in the F8 console. Can you check for recent crash dumps in DRIVE:\Program Files (x86)\MTA San Andreas 1.5\MTA\dumps\private? If you do find new crash dumps, then please upload them to https://upload.mtasa.com and paste the link here (only MTA staff can access it).
    1 point
×
×
  • Create New...