Jump to content

Lpsd

Administrators
  • Posts

    317
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Lpsd

  1. Probably because the song doesn't have any of the data? If you go to the mp3 file itself and right click > properties > details, does it have title / artist data? @koragg should work for any sound element, whether it be a stream or local file.
  2. Lpsd

    table sort

    table.sort(myTable, function(a, b) return a[1] > b[1] end) I think...
  3. Lpsd

    string.find

    local invalid_chars = {"#", "?", "!"} addEventHandler("onPlayerConnect", root, function(nick) for i=1,#invalid_chars do local escape if not string.match(invalid_chars[i], "[^a-zA-Z0-9]") then escape = "%" else escape = "" end if nick:find(escape..invalid_chars[i]) then cancelEvent(true, "Change nickname!") return end end end) I don't know about optimal, but it's definitely easier to manage. updated code to allow for escaping special characters on :find
  4. Then you should continue with the steps, and install node/npm using yum or apt-get
  5. No, but you can easily make them yourself. Make a separate resource called acl-events or such, follow this example; __aclGroupAddObject = aclGroupAddObject; function aclGroupAddObject ( ... ) if ( __aclGroupAddObject ( ... ) ) then triggerEvent ( "onACLGroupObjectAdd", root, ... ); return true end return false end original post; Then you can export the __aclGroupAddObject function (and any other functions you overwrite) and use it in your other resources instead of the original aclGroupAddObject.
  6. Lpsd

    I need help

    fresh, i.e new. Basically, reinstall MTA. If the problems are still happening, try reinstalling GTASA
  7. Lpsd

    I need help

    I assume you have reinstalled MTA, and if that fails - a fresh install of GTA?
  8. also; https://wiki.multitheftauto.com/wiki/Modules/Sockets
  9. Lpsd

    multiaccounts

    cool, however this isn't the place to ask for scripts. If you are looking to hire a scripter, you can do so below. Thanks! https://forum.multitheftauto.com/forum/149-looking-for-staff/
  10. Well first you should make sure you have nodejs and npm installed on your machine. Open up your console/ssh and check with the two commands: # node -v # npm -v If they are installed then a version number will return. If not, it will say 'node' not found or such. If they are not installed, you will need to run the following (FOR CENTOS - INCLUDES EPEL REPO) # yum install epel-release # yum install nodejs (FOR MOST OTHER BUILDS) # apt-get install nodejs # apt-get install build-essential I'm not an expert on Linux but 1 of those two should work depending on what OS you're running. Don't run both of these (yum AND apt-get), you only need to use either yum or apt-get - depending on your OS! After that's done, you should check again with the version commands above to ensure they are installed. Next, download the mta-discord-bot from GitHub and extract the src folder somewhere, I'll call it PATH-TO-SRC in this example # cd /PATH-TO-SRC # npm install After that, you should edit the example.config.json to include the same details that are in the discord bot resource on your MTA server (in config.xml), then rename that file to config.json. Once everything has been edited, you can now run the app.js. This is the relay which grabs the data from your discord and feeds it through to the MTA server resource. I would advise you run this in a seperate screen (terminal multiplexer)... This means that when you exit the SSH/console, the app.js will continue to run. My choice is tmux, install as so; # yum install tmux OR # apt-get install tmux Now you can run tmux, and run node.js # tmux # cd /PATH-TO-SRC # node app.js If it's all working it should run without errors. You can exit from this window at any time and return to your standard SSH screen by pressing CTRL + B, then let go and press D To re-attach to that window, check your tmux sessions and attach, ie; # tmux list-sessions 0: 1 windows (created Wed Aug 16 18:24:24 2017) [80x23] # tmux attach -t 0 0 in this case being the session id, as shown from list-sessions. If you run into any trouble let me know
  11. @Moha|M| Still need help? What OS are you using?
  12. How are you using your texture? Functions such as dxDrawImage and dxDrawImage3D already have rotation arguments. I don't work with shaders much either, but if you're using your texture with a shader I assume you can just rotate the texture using the shader itself.
  13. Does doing this change anything? local key = slot[3] outputChatBox(tostring(i).."|"..items[key][2]) If not, I expect something is going wrong elsewhere in the code. How big is this script file? Could you show more, via pastebin or such?
  14. I've been involved with computers and programming since as long as I can remember - I was making my first :~ty HTML sites at the age of 7. You can spend months, even years learning a single programming language; but one thing that really broadened my entire understanding of computing / programming was a computer science class that I took during my high school years. Computer Science takes you back to the basics, it teaches you the standards / logic used throughout pretty much all programming languages. From variables to functions, arrays to expressions - even taking the time to learn the difference between different data types, such as strings, floating points, integers and booleans - that'll make a huge difference to your general understanding of programming. Just because you can put bits of code together and run it successfully doesn't make you a good or professional scripter. It's something that I see often on this forum in-fact. What makes you a good programmer is knowing exactly what your code does, and how to debug & fix your code as soon as a problem arises. This also means that being great in a certain programming language isn't all it takes - you need a good, logical brain too. Being able to come up with fresh & creative ways on how to achieve your "goals", and thoroughly thinking through your ideas. I'd suggest you start with something like this https://en.wikiversity.org/wiki/Introduction_to_Computer_Science Once you're confident with that, w3schools is a great website to start writing your first bits of code. Check out their HTML and Javascript tutorials (which includes their "Try it yourself" code editor in each example!) Good luck.
  15. Lpsd

    bindKey

    @xFFrozen - and little did he know he'd just made a complete and utter fool of himself. What a pillock you are, sir. OnClientResourceStart will be triggered when a resource has been fully initialized on the clientside. This means it will trigger; a) when a player joins the game, and that resource has been fully downloaded b) when the player is already on the server, and the resource is loaded/restarted I have attached it to the root of the given resource, which means the event will only trigger for that resource.
  16. Lpsd

    bindKey

    @Master_MTA re-read the Wiki, control names are also a valid input here. You need to trigger bindKey when the client joins / the resource is started. At the moment bindKey is only being triggered when the resource is started. function shootProjectile() if not isTimer(shootCooldown) then shootCooldown = setTimer(function() end, 1000, 1) local vehicle = getPedOccupiedVehicle(localPlayer) -- Only create projectile if we are inside a vehicle if getElementModel(vehicle) == 411 then local x, y, z = getElementPosition(vehicle) createProjectile(vehicle, 19, x, y, z) end end end function setupProjectileBinds() bindKey("vehicle_fire", "down", shootProjectile) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), setupProjectileBinds)
  17. You'll have to be more specific. You want to restart the MTA server when what happens?
  18. Use callRemote or fetchRemote - the only way without creating your own server module (afaik)
  19. Lpsd

    effect colhape

    https://wiki.multitheftauto.com/wiki/SetDevelopmentMode I have no idea what you're actually trying to ask about the image though, that picture isn't of MTA...
  20. there isn't any feature like this, he was suggesting it
  21. That's exactly why I gave you the solution and linked to more information on the Wiki If you are new to coding entirely you really should do yourself a favour and take some tutorials on basic computer science or general programming. This will give you an overview of how pretty much every programming language works (but don't get confused, it won't tell you how to code in all programming langauges, just the inner workings / behind the scenes) - ie data types, logical constructs, etc. After that, you can move on-to a basic Lua tutorial (https://www.tutorialspoint.com/lua/) and MTA Lua introduction (https://wiki.multitheftauto.com/wiki/Scripting_Introduction)
  22. Lpsd

    fetchRemote

    CURLE_UNSUPPORTED_PROTOCOL (1) The URL you passed to libcurl used a protocol that this libcurl does not support. The support might be a compile-time option that you didn't use, it can be a misspelled protocol string or just a protocol libcurl has no code for. Maybe it's because you're using https in the url (fetchRemote)? Try changing it to http
  23. I assume this is the line the error is happening on (hard to tell since you have removed some of the code) local accName = getAccountName(getPlayerAccount(source)) source isn't returning a valid player element. You should read the Wiki for command handlers. https://wiki.multitheftauto.com/wiki/AddCommandHandler function toggleCarFlight(playerSource) local accName = getAccountName(getPlayerAccount(playerSource)) end addCommandHandler("zekafly", toggleCarFlight)
  24. I would advise you to check out the Scripting Introduction first, or check out some Lua tutorials (https://www.tutorialspoint.com/lua/)
×
×
  • Create New...