Jump to content

subenji99

Members
  • Posts

    264
  • Joined

  • Last visited

Everything posted by subenji99

  1. Spaces in filenames and resource names cause issues.
  2. Close. So your returned table would look like: pData[player][1]["level"] == 1 --for the first returned row of values pData[player][2]["level"] == 1 --if the query finds a second matching row ...
  3. Correct for your first question - when both files are serverside or both are clientside in the same resource, you just call your function just like any other (as long as you didn't declare the function local that is) For a returned variable, you'll need to triggerServerEvent with another event for the reply. MTA uses elements rather than ID's, so you would assign your table as function myFunction(thePlayer, value) if pData == nil then pData = {} end pData[thePlayer] = value end --example myFunction(getPlayerFromName("Bob"), "someString") and to clear: function cleanUp() pData[source] = nil --look up hidden variables in the events wiki page end addEventHandler(onPlayerQuit, getRootElement(), cleanUp) Note that the value can be anything - string, number, even another table.
  4. I hope it has some feedback on who you clicked on to prevent administrating the wrong person.
  5. Just wait until game-monitor fix their Query server. Your server is still running, if you want to invite people to join you'll have to give them the server's IP address to quick connect/add to favourites in the meantime.
  6. You just vote for a DD map while running the race gamemode. The default resources installation does come with a couple of DD maps, such as race-destructionderby (aptly named ) and race-bloodring. Yes, you will find most servers have custom maps their community have made with the map editor.
  7. You both misunderstood his question about call. Yes, generally, between server and client lua files in the same resource you use events, and you will need a secondary event to get a returned value. As a side note however, if you don't actually need a return value and just want to trigger a function on the "other side", look at these 2 code examples: https://wiki.multitheftauto.com/wiki/CallClientFunction https://wiki.multitheftauto.com/wiki/CallServerFunction Lua doesn't support constants by design, but usually, you don't need to protect a variable from changes either, so a variable will suffice. If you do need to protect a variable from changes, an example is here: http://blog.stranadurakov.com/2009/05/05/lua-constants/ (note that is just standard Lua, not MTA related. Also it deals with metatables, which you shouldn't attempt while you are unfamiliar with standard tables.) The difference between pairs and ipairs is usually just a matter of processing cost in the majority of cases. When you assign values to a table, if you don't provide a key, Lua assigns an integer key, starting at 1 and incrementing for every new value added. ipairs iterates over the table in order, starting at key 1, and stopping when it finds a nil key. (even if there are higher-numbered keys later on) Whereas pairs iterates the whole table, regardless of what keys are there, in whatever order it finds them (which may or may not be numeric/alphabetical/order they were added in) So if the order you iterate the table matters and you used integer keys, use ipairs, otherwise, pairs will suffice and costs less processing time.
  8. Use the locations button.
  9. I think the problem here (and also the reason for this code) is that your table value may or may not contain an element. (rather than may contain a vehicle or other element, but would always have an element there) So it throws an error when the value does not return an element, as getElementType expects an element, but executes fine when it does contain your vehicle element you are looking for. You can safely ignore this warning, or if you want to eliminate any errors (like I tend to do ) alter to if isElement and getElementType.
  10. You also need to open the game-monitor heartbeat port, which is your server port + 123. As your server is on port 22003, that means you need to open port 22126, as well as the ports you've already opened. Although you only need to open port 22005 if you (or someone else) intend to access the web admin page from a computer other than the server itself.
  11. It's quite obvious English is not your 1st language, and I only speak English. What you are trying to do is difficult and you would be better off with help from someone who speaks the same language as you do, just to prevent (or reduce ) confusion.
  12. Ah you meant Hay. Hay doesn't use the map system; it's hay bales are generated via a scripted algorithm, and all the other "mapping" related parts (spawnpoints, destination, etc) are also in the script. You would have to copy and alter the lua script to change the map.
  13. subenji99

    HTTP Error

    https://forum.multitheftauto.com/viewtop ... 91&t=26037 https://forum.multitheftauto.com/viewtop ... 06&t=25791 Learn to search and you won't have to make a thread, and you get your answer sooner.
  14. Hannu's climbing gamemode requires you to make maps using the supplied edf with the gamemode. If you want to make maps for climbing, you'll have to contact Hannu.
  15. I know it's obvious, but you really should credit mabako for the original idea and resource, especially if you copied even a single line of code from his resource. As a matter of courtesy.
  16. --clientside bool setVehicleHandlingData(element vehicle, string handling, int/float value) This explains that question. Using a vehicle element implies it only affects one vehicle, not every vehicle of a particular model ID.
  17. Does this Helpmanager correctly handle custom GUI? You know, for backwards compatibility. I had a pipe-dream helpmanager replacement in my list of ideas to make but haven't got started on it, and this was my biggest concern with the idea. myHelpTab = call(getResourceFromName("helpmanager"), "addHelpTab", getThisResource(), true)
  18. http://www.whatismyip.com/automation/n09230945.asp returns your IP only, no fancy parsing required. A simple matter for callRemote() to read.
  19. Thinking about this brought up an idea: Would there be a good demand for a setPedAnalogControlState (or modify the current setPedControlState) function? Anyone that's seen a "cruise control" script can probably see the reasoning. With analog control over "accelerate", we can eliminate the acceleration-jerking around the desired speed with a simple enough algorithm. I'm sure there would be other uses as well, for the other analog inputs.
  20. I'm sure me or DazzaJay has actually mentioned this somewhere before, possibly on the bugtracker. Apart from the map transfer, your first and second point are the same issue. Downloading 2000 lua files takes FOREVER and the constant requests and serverside file reads slow the whole process down. And sending the files compressed into an archive would fix it. We've seen this effect - one of our servers has custom maps/models, some file sizes going up to 8MB or more. Those transfer as fast as possible - e.g. I get them at my Broadband's rated 20Mb/s. Getting all the admin resource's flag images however... And for your third complaint - yeah, why should the client get a numeric number and NOT reference that against a string table to give out a friendly error? Such a list is on the wiki, anyone who gets an error and knows of the wiki entry does that cross-reference, it could be built into the client. To sum up, I can understand that the dynamic map has to be sent as-is. It's likely to change mid-download etc, and therefore there are considerations involved. But how hard is it to compress the resources for the other transfers? Even one zip file per resource would be a significant improvement, and would then avoid on-the-fly compression as they can be prepared and cached on resource load. Update: Here's a little experiment for the issue you can do on your own PC. Find yourself 2 folders full of files - one of them lots of small files (your browser's Temp folder is probably a good bet) and one of them a few large files. (I'm sure you have some ) Try copying those folders - to another HDD if you have one, otherwise, just to somewhere else will suffice for the example. Monitor the transfer rate. And you will see the problem. It's a flaw of filesystems. Small files have consistently become more difficult to handle as HDD's have grown in size.
  21. If for some silly reason you are storing player elements in a variable and not cleaning that up when they quit then the variable will assert a "bad element pointer" error. But if you are really desperate for such a function then isElement(theVariable) will accomplish this.
  22. Quick Note: In the admin resource, you are not going to find a line such as addCommandHandler("register",registerHandler,true) This is because all the admin commands are saved in 'commands.xml' and that file is parsed recursively. Commenting the line in that xml file works as you would expect however. I forget the path to that file off the top of my head, but you shouldn't have a problem finding it.
  23. subenji99

    MTA and SAMP

    I'd say 1,4, and 6 are the valid ones. As for 3, I'm on the opposite side of the argument. SA-MP's chat system is crude, ugly and basic in my opinion. MTA's is cleaner, better presented, and the text scrolling is a nice touch that shows care in the programming involved. Not to mention customization as you well know. As for 5, well: http://www.facepunch.com Only 100,000+ registered members, 20,000+ active. For one example. Forum signatures have and continue to be a silly idea and an unnecessary waste of space.
  24. subenji99

    MTA and SAMP

    Honestly, I think it's still just certain players haven't evolved enough to learn the skill of reading, and are missing the "press 'b' to join" text while spectating.
×
×
  • Create New...