Jump to content

DiSaMe

Helpers
  • Posts

    1,461
  • Joined

  • Last visited

  • Days Won

    34

Everything posted by DiSaMe

  1. https://wiki.multitheftauto.com/wiki/GetElementMatrix Look in the examples for getPositionFromElementOffset
  2. What is "new GTA map"? How do you define it, "new GTA map"?
  3. https://community.multitheftauto.com/index.php?p= ... ls&id=2540 or http://crystalmv.net84.net/pages/script ... attach.php exports.bone_attach:attachElementToBone
  4. DiSaMe

    Question

    table[key] = function(arguments) -- function body end
  5. 'loadfile' doesn't download any files. 'loadfile' loads the specified file as a function and returns it. It doesn't even work in MTA, it's disabled for security reasons because it loads the file from any specified path, not limiting it to resources directory. Instead, MTA file functions have to be used to read the contents of file into the string and load them as a function using 'loadstring'.
  6. Thanks, but I'm not sure if I can do this job well With great power comes great responsibility, and I wasn't sure what's what with that action that went down here But based on what I saw, I think manve1 and Grafu can take care of things, so I vote for them.
  7. SELECT LAST_INSERT_ID()
  8. table.insert inserts the value into first empty field under integral key starting from 1. That is, if the table is empty, 'table.insert(serials, serial)' will do the same as 'serials[1] = serial', second time it will do the same as 'serials[2] = serial', and so on. Your checkPlayer function, on the other hand, gets the value from table under the value which is nil, since 'serial' variable is not defined. Which means 'serials[serial]' is nil.
  9. getGroundPosition isLineOfSightClear processLineOfSight
  10. This is the attitude I don't like. Such area like 800x600 has enough space to display lots of stuff. As for myself, I use 1366x768, but I designed my server's GUI to fit all resolutions, and while some details might be harder to read at 640x480, the GUI is still usable without problems at this resolution. It's not like 800x600 is too small. It's more like the objects displayed are too big.
  11. "onPlayerDamage" or "onClientPlayerDamage" killPed
  12. "Much faster" how? "More stable" how? And what capabilities are you talking about? Lua is Turing complete language, therefore it is capable of solving any computational problem, just like Python. If you're talking about stuff in Python standard library which should not be allowed to be freely executed by scripts downloaded from servers, then they would have to be reimplemented anyway for security reasons. It's like with file functions, Lua has them but MTA disables them and instead provides its own file functions to prevent the scripts from messing with files anywhere outside resources directory. That said, I like both Lua and Python. They're my favorite scripting languages, but I still prefer Lua for its simplicity. I don't remember encountering stability problems and because of variety of criteria for performance, I can't see Python as "much faster" than Lua. Personally, I would like to see both Lua and Python in MTA, but since one language can already be used to do all the stuff, second one would provide little benefit, especially since potential security issues would need to be taken care of. I agree that ad populum is a bad argument though. "People say so" has never been an accurate way to determine the objective reality. That's why I don't use popularity as an argument except as a troll response to opponents who use the same fallacy
  13. setElementPosition setElementRotation setElementVelocity setVehicleTurnVelocity Not saying the suggestion is useless, I'm just saying it can already be scripted.
  14. DiSaMe

    table.sort

    This function has to be used for exactly what it does, sorting. It sorts the values in array (table with numerical keys starting at 1) in a particular order determined by the function passed as the second argument, or in increasing order if no function is given.
  15. DiSaMe

    Resource-data

    https://wiki.multitheftauto.com/wiki/Event
  16. DiSaMe

    table.sort

    It sorts the values in the table. Isn't the name self-explanatory?
  17. As a workaround, you can use either of these functions: isLineOfSightClear getGroundPosition Ped's center is 1 unit above the ground.
  18. Exactly. Unlike SA-MP, MTA doesn't do this kind of stuff for scripters - instead, it gives them flexibility to do it themselves. That allows you to have your own models, your own GUI and lots of other things which you can't have in SA-MP.
  19. MTA Lua and programming is NOT the same thing. C/C++/x86 assembly and programming aren't the same things either. Not a single programming language or scripting engine is the same thing as "programming".
  20. Shader is a program for graphics processing, typically executed by graphics card. In MTA, shaders can be applied to specific elements. Which means different elements with the same model IDs may look different. Shaders make it possible to change the texture or reposition the vertices but I'm not sure about geometry shaders, the ones that generate new primitives, which is needed for full flexibility of this kind of model replacement.
  21. DiSaMe

    Table question

    some_table.i is the same as some_table["i"], not some_table
  22. Call the function from client-side script and the object will be created for the client. But I think it's better to create server-side objects in different dimensions and put the player in dimension depending on gamemode choice.
  23. Values of variables don't change themselves, so condition evaluates to true. Using getElementType will help, but it will still output a warning message if passed element does not exist. To avoid warnings, check element's existence with isElement before checking its type. However, even then the code is not guaranteed to work fine. If element gets destroyed and another one gets created, it's possible for new element to get the same ID (or memory address, I'm not sure what it is, but it doesn't matter) which the previous element had. If that happens, variables which held the value of previous element will start referring to the new element. So if one player quits and another one joins when the timer is still running, it's not impossible for the timer to do stuff with the new player. To guarantee that it won't happen, you need to kill the timer with killTimer when player quits instead of checking player's existence in the timer.
  24. Resource cannot "run for 1 player" because resources don't "run for players". Resources run globally, and it's not clear what "running for player" is supposed to mean. For example, if chatbox message appears for one player and not for others, it means outputChatBox was called with that player as argument. It was not called "for player", it was just called, and player was passed a an argument. As you can see, there's no magic, just logic.
×
×
  • Create New...