Jump to content

Addlibs

Members
  • Posts

    1,060
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by Addlibs

  1. You'll need to use addEventHandler for onClientGUIClick both the deposit and withdraw buttons. You'll want the handler functions each to call triggerServerEvent which would inform the server that a client wants to deposit or withdraw and the amount. Each of those events should also block both buttons from being pressed again until the balance updates. You also want to addEvent and addEventHandler for an event with a balance update from the server, and this event's handler function should update the displayed clan balance text label, and enable the deposit and withdraw buttons, which we previously disabled after the initial click. Now, on the server side, you'll want to addEvent both events and mark them as remotely triggerable, then addEventHandler for each of those events and the handler functions should then verify whether the amount being withdrawn is not more than what the clan's account balance is, and that the deposit amount is not more than what the player has at hand. Additionally, and especially for the deposit amount, you want to make sure the number is greater than 0. After these verification, you'll want to addPlayerMoney or takePlayerMoney and update the clan's balance, which depends on how you store it. Then you should triggerClientEvent some update event to inform the client of the clan balance change. Considering you've implemented blocking of the deposit and withdraw buttons upon initial click, you'll want to send the update event even if balance transfers were not performed due to insufficient balances or what not, sending the unchanged balance, to unblock the deposit and withdraw buttons again on the client-side. You can read more about GUI based client and server interactions on Introduction to Scripting the GUI › Scripting the button
  2. Your problem is that the function getResponsiveSize isn't defined.
  3. You likely won't be able to intercept these messages as MTA's network communication is encrypted Server_mtaserver.conf#networkencryption and the ability to disable it was removed in commit 4e89dd81e0914a30688941768c0c3dfe104727f4 over 5 years ago. The actual encryption of network communications happens within the closed-source net.dll file. Even if you were to manage to decrypt somehow, you'd still need to copy and keep up-to-date headers for the packets (Packets.h and packetenums.h and additionally most, if not all, external dependencies those files have), as the packets aren't named in the payload, but rather numbered, and the definitions for which ID refers to which packet may (though probably won't, but making this assumption isn't a good idea) change in the future.
  4. When creating a browser you need to specify 'true' for the isLocal parameter to be able to load local files.
  5. This event is used by the files mapEditorScriptingExtension_c.Lua and mapEditorScriptingExtension_s.Lua in map resources. Perhaps you've accidentally removed the server (the one ending with _s.Lua) script from the meta.xml and hence the error arose.
  6. You haven't explained what the issue is, but I'm going to guess that the resource simply doesn't turn on when you type /res, and that is likely because you haven't given this resource (the one with this code snippet) ACL permission to function.startResource.
  7. You could create a PHP app that connects to the MTA server through the MTA SDK, letting a user log in using an internal MTA account, and then allow the user to link that account to Discord by using a Discord OAuth2 app that requests permission to the 'identity' scope and then requests and collects the discord account's snowflake ID and passes it onto MTA through the SDK. The OAuth2 app would also be able to collect this information but the email would only be filled if the 'email' scope was also requested.
  8. Addlibs

    Mods Loading

    Have you tried engineSetAsynchronousLoading? That will make mods load in their own time instead of freezing the whole client to load before continuing. Of course this means mod loading will be slower, but it won't freeze the client.
  9. getRealTime returns the hour in 24-hour format, from 0 to 23
  10. Alternatively (a simpler solution that doesn't require tracking loaded players) you can simply have the server tell the client the list of peds to mute when the client is ready and asks for it. That is, [client] -> onClientResurceStart -> triggerServerEvent informing server that client is ready -> [server] -> triggerClientEvent with list of zombies -> [client] -> setPedVoice for each zombie received. This fixes zombies not being muted if the event was received before the client was ready, but it won't suppress the warnings about sending events before the client is ready - for that, you will need to track whether the client is ready before triggering the events.
  11. I'm not sure but I never had problems with conversions from .map to Lua code which is what I used it for mostly
  12. Well that's why the error pops up. You cannot compare an undefined values. You need to define everyZombie and newZombieLimit at the top (or another appropriate place) of the script. everyZombie = {} -- no (empty table) zombies at beginning newZombieLimit = 100 -- or some other value
  13. Is everyZombie and newZombieLimit defined anywhere?
  14. Perhaps you're looking for something like http://gtamap.delux-host.com/converter/. You can convert from a lot of different formats into MTA Lua code or .map XML
  15. Do you know how to inspect HTML? Use the web inspector (Ctrl+Shift+I on Firefox, probably similar on Chrome) built into your browser, specifically the picker tool (Ctrl+Shift+C on Firefox, not sure what it is on Chrome) which lets you click an element to jump to it's HTML lines. Click the table, and copy-paste the HTML of it here.
  16. Depends. Is it your own website? Does the website have an API that would make this easier? If it's a no to both, then you'll need to use fetchRemote to collect the HTML code, find the table element and parse it yourself. An API would be a lot easier though. If you own the website you can make your own API.
  17. Isn't that exactly what he wants? Cleaning (not defragmenting) can be achieved by removing those files (either by deleting or moving somewhere else - as I stated in the previous post, I recommend the latter) and starting up the server to generate new blank DB files. The point is you don't actually have to completely delete the whole server to start fresh, you just need to wipe the databases by removing them; and you don't "download cleaned" files, you let the server generate new, blank, DBs if you want to remove all of the data in them. This is very true. It would be wise to wipe the contents of directories with dynamically filled content, and perhaps reset configurations but I guess the reason one would want to wipe the database without wiping the server directory is to keep resources and configurations.
  18. That's because you call getPlayerCount when you create the string, and you created the string only at start time. What you probably want is MensagensInfo = { "There are #FF0000\(plrCount)#FFFFFF players in the server", "Welcome the server", } and then change line 9 to the following lines: message = MensagensInfo[math.random(1, #MensagensInfo)] -- select a random line from MensagensInfo table message = message:gsub("\%(plrCount%)", getPlayerCount()) -- replace \(plrCount) with current player count (has no effect if \(plrCount) isn't present in the string) outputChatBox(message, getRootElement(), 255, 255, 255, true) -- output the replaced string
  19. I'm pretty sure you can safely delete them (though I'd advise just moving them into a seperate directory at first if you believe you want to migrate at least some of the data from there at some point) and start up the server, which should generate new internal.db and registry.db files, without any data.
  20. First of all, you've linked an empty pastebin. Secondly, you should check /debugscript 3 ingame both at the time of starting the resource and at the point it's supposed to do something, and tell us if there's any debug errors popping up with the resource's name. If so, please tell us what these are.
  21. Easy mistake. You're applying the wanted level to the wrong element (to the account instead of the player) Line 13 should be setTimer (setPlayerWantedLevel,500,1,source,wantedLevel)
  22. This isn't a requests section. We can guide you on how to do it, or help you out with particular patterns or algorithms, but we will not script for you. If you don't want to script it yourself either look through community.multitheftauto.com or pay someone to script it for you.
  23. function RGBToHex(red, green, blue, alpha) -- Make sure RGB values passed to this function are correct if( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then return nil end -- Alpha check if alpha then return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha) else return string.format("#%.2X%.2X%.2X", red, green, blue) end end From MTA wiki useful functions, by NeonBlack
  24. This is a question for you. How do you want to the spawn location chosen? At random? If so, you'll want to use math.random between 1 and the number of spawn points you have, and then take the coordinates for that index. E.g. local spawns = { {x1, y1, z1}, {x2, y2, z2}, ... } -- later in the code when you're actually spawning local spawnIndex = math.random(1, #spawns) -- select a random index between 1 and number of spawns local spawnX, spawnY, spawnZ = spawns[spawnIndex][1], spawns[spawnIndex][2], spawns[spawnIndex][3] -- collect it's first, second and third parameters (x, y and z position)
  25. mysql_ping is part of an external module called MTA-MySQL, which is essentially deprecated at this point. It's way too old and I do not recommend using it. There are newer, better, built-in alternatives like dbConnect, dbQuery, etc. You should change the script's calls to those functions with the newer built-in (non module-based) functions.
×
×
  • Create New...