Jump to content

johny46

Members
  • Posts

    81
  • Joined

  • Last visited

Details

  • Location
    Poland

johny46's Achievements

Transformer

Transformer (11/54)

1

Reputation

  1. I wouldn't say he absolutely has to remove these, but indeed, these are a bit pointless.
  2. Have a look at lines 18. and 19. And then 34. and 35. too.
  3. Can you recommend any alternative? Where do you think such data should be stored?
  4. Both of the loops you mentioned in your post are used to iterate through all (not necessarily) elements of a table. Let's say you've got a table like this: myTable = {5, 4, 3, 2, 1} If you wanted to execute some specific code on each element of the table, you would have to iterate through it. It can be done in a lot of ways, but let's first take the one easiest to understand: for index = 1, #myTable, 1 do outputChatBox(myTable[index]) end What this code is, is basically a regular "for" loop, where the number of repetitions is determined by the length of the table. In this case, #myTable returns 5, so the code inside is executed 5 times, then it continues on something else. With each loop, the index variable gets increased by one, so you can then do myTable[index] in order to work with the values of the table. So with each loop you can output one value of the table, or do any other stuff with it. Now onto something slightly different, a for loop with an iterator: for index, value in ipairs(myTable) do outputChatBox(value) end This code should output exactly the same data as the earlier loop, but it uses different construct. What this loop does, is automatically going through the entire table and with each repetition, it updates the index and value variables with current ones. The value variable is going to be the same as myTable[index], but it is just more convenient because you don't have to read these values manually. For further reading and some more examples I recommend you to go to http://www.phailed.me/2011/02/learn-lua ... ay-tables/ It explains the whole thing really great. If you think you've understand everything I was talking about, then it will be really easy for you to spot the obvious misconceptions and errors in your code, so you will be able to fix it yourself.
  5. Could you elaborate on that?
  6. This function is client side only.
  7. Nie jest to najwydajniejsze rozwiązanie, bo za każdym razem musisz iterować po całej tablicy. Zamiast tego, mógłbyś zmienić sposób zapisywania elementów w tablicy: tablica[id] = true -- id zajęte tablica[id] = nil -- id wolne następnie aby sprawdzić, czy dane id jest zajęte, po prostu sprawdzasz taki warunek: if tablica[id] then -- id zajęte else -- id wolne end
  8. CEGUI is much easier to use, and the resulting code is probably going to be cleaner, but keep in mind it could look differently on each player's screen due to theming. Dx gui can be annoying and hard to write, but then you can be sure it will look exactly the same on all clients and it also means you have the full control over how windows look and behave, which isn't very true for CEGUI.
  9. Thank you for replies, guys. Appreciate it. It is a free VPS, so it's quite low power. No mistake here, it's only 128 MB RAM. I wanted to create a simple multi gamemode server with maybe 3 or 4 not so heavy gamemodes. Basically some mini games, as for example the haystack gamemode (I won't be using this one particularly, just an example). In my first post I made a typo, but I actually meant I will be hosting no MySQL or any other database. All I plan to have there is MTA server binaries and Nginx serving static files. Currently with only nginx running, the memory usage stays at 4 MB for the whole system, so there's like 124 MB left for the server, or even more including SWAP. I don't expect to even have as much as 20 - 30 players. I'd probably keep the player slots to 16 or maybe 20 when I see there's more traffic. With these specifications, and assuming the scripts are written properly without memleaks, do you think it could do the job?
  10. Hi. I've got a VPS with such parameters: Download250 MbpsUpload10 MbpsRAM128 MBSWAP256 MBCPUi7-2600 @ 848 MHzVirtualizationOpenVZDistributionDebian 7.0 with some modifications as a lighter SSH server and such Would it be possible to estimate how much players could such a server handle without too much lag? I'm already running nginx with gzip compression enabled, the MTA server is configured to save bandwidth and the sync intervals are a bit higher (that is longer) than default. I'll be running to MySQL database. If I'll need any database functionality, I'm going to use the MTA built in one. My scripts will be mainly clientside to not use the server CPU time too much. With all that, would it be possible to have let's say 16 players at the same time playing together? If not, can you tell me what would be the biggest bottleneck in such configuration? I'm worried the upload speed could be a bit too low. What do you think?
  11. I don't think the code you found allows you to have 3D voice. I think it's more about either letting you hear people or not, based on the distance between them and other players.
  12. johny46

    [HELP] Spawn

    addEventHandler("onPlayerLogin",root, function() local accName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accName, aclGetGroup("V.I.P")) then spawnPlayer(source,3227,-690,108) end end ) Try this. If it still doesn't work, please provide the debugscript output.
  13. Have a look at this: http://lua-users.org/wiki/TernaryOperator
  14. You could use Windows Grep's "replace" function. See http://www.wingrep.com/ for more details.
  15. johny46

    Script-Base

    You're going to use these functions: getPlayerMoney() takePlayerMoney() setRadarAreaColor()
×
×
  • Create New...