Jump to content

Search the Community

Showing results for tags 'discussion'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Member Title


Gang


Location


Occupation


Interests

Found 4 results

  1. Hello everyone i want to do something like this I want to do something like this but i cannot find true command,function for that black bars i dont know can we do like a tunnel look like this but can you boys help me to how can i add black area like this i can complete my cod rest of them is not too complicated thanks for everyone
  2. I have heard that inserting players in a new table with 'for i = 1, #playerTable' method reduces the time it takes for the loop to complete, as compared to the more common 'for k, v in ipairs / pairs' loop. I know that the first method is more efficient from Lua guides, but I fail to understand the logic behind it. In the case of the common loop, it would directly iterate over the table returned by getElementsByType. As for the for i = 1 method, we would first have to add the contents of the table (returned by getElementsByType) in a new indexed table, in this instance, playerTable, and then we would loop over it once again to get the players in it. I wrote the following code to compare the time it takes to finish each type of iteration. However, both results were 0. Perhaps, it is because the difference is so minute that the machine is not able to identify it? If that's so, whats the point of preferring the first type over the second, when the difference is barely noticeable? local players = getElementsByType("player"); local playerTable = {}; local sT = getTickCount(); -- Supposed to be a faster way? for i = 1, #players do playerTable[i] = players; -- Insert players in a new indexed table. outputChatBox(getPlayerName(playerTable[i][1]), root); local eT = getTickCount(); outputChatBox(eT - sT, root); -- Output: 0 end -- Compared to the more common loop for k, v in ipairs(players) do outputChatBox(getPlayerName(v, root)); -- Directly access the contents of the table. local endTime = getTickCount(); outputChatBox(endTime - sT, root); -- Output: 0 end EDIT: I realised there is no need to insert the players in a new indexed table. (Still the same output) for i = 1, #players do outputChatBox(getPlayerName(players[i]), root); local eT = getTickCount(); outputChatBox(eT - sT, root); -- Output: 1 end -- Compared to the more common loop for k, v in ipairs(players) do outputChatBox(getPlayerName(v, root)); -- Directly access the contents of the table. local endTime = getTickCount(); outputChatBox(endTime - sT, root); -- Output: 1 end Why is the first sort of iteration faster? Would the difference be even larger, if the number of players were extraordinarily large? If that's the case, I'd understand why we would want to use the first loop over the second.
  3. MTA is alive for several years, has always been evolving. But what is missing in the MTA, specifically in SA, what kind of server or game mode have you always dreamed of finding? I hope you contribute with this personal research. Thank you!
  4. I've been searching for a MySQL tips and noticed there is no such topics on this forum. So let's fix this little problem. I want to know more about optimising MySQL queries and how to interract with MySQL correctly, I am newbie in that. I learned that putting queries in the loop it's too performance-expensive, wrong, and very big chance it'll freeze your server for uncertain time. So if I want to get information from DB for a many players, better to make it using only 1 query. Example: "SELECT * FROM race_stats WHERE playerID IN(??)" Where "??" = table with logged in players. But, what if I want to update information for a many players at the same time? How such query should look like? For 1 player it looks like this: "UPDATE race_stats SET id1 = id1 + ?, id2 = id2 + ?, id3 = id3 + ?, id4 = id4 + ?, id5 = id5 + ? WHERE playerID = ?" But how to make the same for all players? Put query in the loop will be too performance-expensive I guess and will create laggs. P.S. Maybe for such thing as player stats better to learn MySQL procuderes and create procedure for this, I am newbie, just asking. Don't even know what is procedures exactly, just heard about it.
×
×
  • Create New...