Jump to content

botder

MTA Team
  • Posts

    524
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by botder

  1. botder

    Device Selection Dialog

    In your Video settings should be an option called Enable Device Selection Dialog, which you can un-tick to disable that dialog. This dialog shows the name of your GPU, where each of your monitor is plugged into.
  2. Get the entire file content after the position where you want to write your new string, then write your string and the file content afterwards.
  3. If you want to test your script with two players on a single machine you should use a virtual machine. If you want to run two servers on your local machine you have to run both servers on different ports. If you want to play on two servers simultanously then you should go with the first option. I didn't understand your suggestion/idea.
  4. setElementData (RoundTime1,"RoundTime1",getElementData (RoundTime1,"RoundTime1") - 1) You can't do minus one on a string, thus you got attempt to perform arithmetic on a string value.
  5. Can you provide more details?
  6. You can run MTA:SA in a virtual machine, which in turn is running Windows. You can also run GTA:SA (and maybe MTA:SA) with Wine. There are no other options, because MTA:SA only supports the Windows release of the GTA:SA game.
  7. You should use the following URL for Soundcloud application registration: http://soundcloud.com/you/apps/new. vmuzice.com is not available in my country and you don't escape search queries. The resource doesn't require the entire admin ACL range, you can put it into RPC or use aclrequest in meta.xml.
  8. Learn to read. https://github.com/Necktrox/mta-discord-bot
  9. You can make your own script, which is loaded before the encrypted script. You can overwrite functions in your own script to output the URL in debug and then spoof the result whenever the encrypted script does a callRemote. -- Store the original function local _callRemote = callRemote -- Overwrite the global function for our purpose function callRemote(url, a, b, c, d, ...) outputDebugString(("callRemote(%q, ...)"):format(url)) -- Should we spoof the result? if url ~= "<url which returns ip>" then return _callRemote(url, a, b, c, d, ...) end -- callRemote(url, callback) if type(a) == "function" then return callback("<fake data from url>", 200, b, c, d, ...) end -- callRemote(url, attempts, callback) if type(b) == "function" then return callback("<fake data from url>", 200, c, d, ...) end -- callRemote(url, attempts, timeout, callback) if type(c) == "function" then return callback("<fake data from url>", 200, d, ...) end -- callRemote(url, queueName, attempts, timeout, callback) if type(d) == "function" then return callback("<fake data from url>", 200, ...) end end
  10. Unable to edit my previous post. Anyway, there are two functions, which might do what you want: saveMapData and loadMapData
  11. function splitf(input, separator) local output = split(input, separator) for index = 1, #output do local fragment = output[index] if fragment:match("^%d") then output[index] = tonumber(fragment:match("^%d+%.?%d+")) end end return output end Example: output = {"Hello", "123", "World", "123prefix", "3.141wtf", "suffix456"} 1 Hello string 2 123 number 3 World string 4 123 number 5 3.141 number 6 suffix456 string
  12. What you want is data serialization. There are different ways to store information e.g. in files, in memory, in databases etc. You should consider that other servers might want to store other useful information about elements (e.g. you might store the owner of the vehicle) and each of these servers use a different method to store the information. You have the Lua language and the MTA functions to make your own serialization structure. You can go ahead, make a serialization "library" for MTA and release it for others.
  13. The map editor is working in the dimension 200, that's not a bug. Why do you need an other dimension in the map editor? https://github.com/multitheftauto/mtasa-resources/blob/master/[editor]/editor_main/workingdimension.lua
  14. --[[ Draw a fancy bounding box: c-----d |\ /| | \ / | | x | | / \ | |/ \| a-----b ]] local minX, minY, minZ, maxX, maxY, maxZ = vehicle:getBoundingBox() local a = vehicleMatrix:transformPosition(Vector3(minX, minY, maxZ)) drawTextOnWorldPosition("a", a) local b = vehicleMatrix:transformPosition(Vector3(maxX, minY, maxZ)) drawTextOnWorldPosition("b", b) local c = vehicleMatrix:transformPosition(Vector3(minX, maxY, maxZ)) drawTextOnWorldPosition("c", c) local d = vehicleMatrix:transformPosition(Vector3(maxX, maxY, maxZ)) drawTextOnWorldPosition("d", d) dxDrawLine3D(c, d, 0xFFFF0000, 1.0) dxDrawLine3D(a, b, 0xFFFF0000, 1.0) dxDrawLine3D(c, a, 0xFFFF0000, 1.0) dxDrawLine3D(d, b, 0xFFFF0000, 1.0) dxDrawLine3D(a, d, 0xFFFF0000, 1.0) dxDrawLine3D(b, c, 0xFFFF0000, 1.0) function drawTextOnWorldPosition(text, vecPosition) local x, y = getScreenFromWorldPosition(vecPosition) if x and y then dxDrawText(text, x, y, nil, nil, 0xFFFFFFFF, 2.0, "default-bold", "center", "center") end end You didn't tell me what you want to do, my previous code segment only solved the question in the first post.
  15. You need OOP enabled: function getElementRotatedBoundingBox(element) local elementMatrix = element:getMatrix() local minX, minY, minZ, maxX, maxY, maxZ = element:getBoundingBox() local minVector = elementMatrix:transformPosition(Vector3(minX, minY, minZ)) local maxVector = elementMatrix:transformPosition(Vector3(maxX, maxY, maxZ)) return minVector, maxVector end
  16. Look at the repository, it has a Makefile e.g. in ml_system. https://github.com/multitheftauto/multitheftauto-modules
  17. addEventHandler("onClientPlayerSpawn", root, function () setPedCanBeKnockedOffBike(source, false) end ) This would prevent any player to be knocked off his bike. Furthermore, this snippet is clientside, because setPedCanBeKnockedOffBike is a clientside-only function.
  18. You have to use cancelEvent in the onPlayerChat event if messageType == 1 and place your /me related code there.
  19. You are missing the socket module for your MTA server. There is a check in place to prevent starting the resource without it, which you probably circumvented, because the resource stops immediately if it's not available.
  20. botder

    Timer :v

    1 second 1 minute = 60 seconds 1 hour = 60 minutes = 3600 seconds 1 day = 24 hours = 1440 minutes = 86400 seconds 1 month = 31 days = 744 hours = 44640 minutes = 2678400 seconds 1 year = 12 months = 365 days = 8760 hours = 525600 minutes = 31536000 seconds
  21. https://github.com/Necktrox/mta-discord-bot/commit/da6cd936a57ef106b2c612fd7dec0bc893de216c Fixed, I didn't test this part of the code, because I modified my config to include the "Bot " prefix and never tested it without it. Sorry for any inconvenience.
  22. There are 3 parts, the relay server and 2 MTA resources. You can install PM2 (Unitech/pm2) to launch the relay node.js server. You only have to duplicate example.config.json as config.json, make your changes to the configuration and run the relay. Below is a copy of my PM - how to configure the relay. Token Visit Applications @ discordapp.com Create a new application if not done yet or select an existing one Create a bot user for the application Reveal the bot user token (you have to click on 'click to reveal') Copy the entire bot token and paste it into your config (see example below) Note: Do not share this bot token with anybody, because they will have access to the bot user. Passphrase This is a random text passphrase you can set to anything you want. Make sure the MTA resource uses the same passphrase in the configuration, otherwise the MTA resource won't be able to authenticate with the node.js relay. The passphrase is like a login password just to make sure nobody can connect to the node.js relay and send messages/spam without your permission to do so. Example Configuration? { "port": 8100, // You can use any port you want "passphrase": "super-secret-password", // You can use any passphrase you want "server": "228439442069651456", // Discord server/guild id from Mr.Green Discord guild "bots": [{ "channel": "race", // Name of the channel the bot communicates on (here: #race, do not include the hash #) "token": "bot.token" // Your secret bot user token (do not share this code with others) }] } Warning: JSON configuration files do not support comments. Remove these.
  23. One the one hand you are forced to keep OOP disabled in any resource, which uses the socket module's functions; and I like to use the OOP methods, because the code looks cleaner and easier to read when you try to understand it. On the other hand, you can restart the event handler resource without interrupting the connection with the Discord relay - I have to admit here, that I didn't have any specific reason not to use one resource, it was personal preference. I actually encode the JSON string with base64 to avoid this issue, see here.
  24. I have released a self-hosted Discord relay some time ago, but didn't bother posting here or adding documentation. @specahawk, you can tell me to remove this post if you don't want to have this advertising in your thread. Anyway, the code is on GitHub (Necktrox/mta-discord-bot) and it's being used by Mr.Green, one unknown guy and my clan's server. It doesn't support any commands, but the implementation is up to you (the bot recognizes commands with dot (.) prefix). It's running perfectly stable for months.
×
×
  • Create New...