• Content Count

  • Joined

  • Last visited

Community Reputation

96 Popular


About majqq

  • Rank

Recent Profile Visitors

1,348 profile views
  1. It should be something like that: (if am i wrong i hope someone will correct me) local startTick = getTickCount() local players = getElementsByType("player") -- ipairs for i = 1, 10000 do for index, player in ipairs(players) do outputChatBox(getPlayerName(player)) end end outputDebugString("ipairs done in "..getTickCount() - startTick.." ms.") -- pairs startTick = getTickCount() for i = 1, 10000 do for index, player in pairs(players) do outputChatBox(getPlayerName(player)) end end outputDebugString("pairs done in "..getTickCount() - startTick.." ms.") -- int startTick = getTickCount() for i = 1, 10000 do for i = 1, #players do outputChatBox(getPlayerName(players[i])) end end outputDebugString("int done in "..getTickCount() - startTick.." ms.") By the way, if you gonna use some variables in loop, it is better (faster) to declare them out of scope, and reuse them. I suggest to test it singly, because sometimes it could give you different results, as you can see here - pairs should be faster than ipairs - as far i know Separately:
  2. Related, perhaps you doing it wrong. And yes for i = 1, #tablesize is faster, much people don't care much about performance. I can tell you that with integer loop, i achieved pretty nice performance boost on bone attach resource (and some other tricks.)
  3. So explain what doesn't work in here?
  4. By the way there's no need to attach sound by using bone attach. You can use attachElements instead -
  5. majqq

    Help a layman!

    Should help a bit -
  6. Randomize damage every time zombie is hitting you.
  7. majqq

    Gamemode DayZ!

    Why not create your own gamemode, instead of basing on something that is badly written? From public:
  8. If uses data from table, then there's is your problem: gameplayVariables["zombiedamage"] = math.random(800,2000) It is only randomized once, on script initalization.
  9. In my honest opinion this would be worse, you are just complicating it, but before that. 1) Don't attach events to root, use resourceRoot instead - this is sufficient if event is handled by same resource, as wiki says events attached to root are very CPU intensive (client/server) 2. getLocalPlayer() it's a function call which returns local player, you should use existing predefined variable localPlayer instead. 3. Use client predefined variable on server-side, when using events - 4. ipairs it's slowest loop you can use. You might use integer loop which is fastest loop: local players = getElementsByType("player") local player = nil for i = 1, #players do player = players[i] -- it's your player end I understand you, and your trial to improve an server/client performance, i'm one of those persons which care about that. To the point, the way you presented above could by replaced by simply server-side check for players around (i suggested possibility to add table as receiver instead of looping players, hope someone would do it) rather than sending informations to client and sending it back to server. Passing data between sides seems to be more expensive. If i am wrong, i'm pretty sure IIYAMA could correct me.
  10. Why? I'm using tables n triggers since past year, and everything works well :)
  11. You can pass tables in triggerClientEvent/triggerServerEvent as argument.
  12. Perhaps you use maybe wrapper for element data? if GetElementData(player,"AdminLvl", 5) then Should be: if getElementData(player,"AdminLvl", 5) then Lua is case sensitive.
  13. This will work faster and better: local players = getElementsByType("player") local playersList = {} local player = nil for i = 1, #players do player = players[i] if player ~= localPlayer then playersList[#playersList + 1] = player end end We use integer loop, which is fastest loop so far. We avoid using table.insert, manually adding is faster.