Jump to content

Gallardo9944

Members
  • Posts

    442
  • Joined

  • Last visited

Everything posted by Gallardo9944

  1. Technically client doesn't care what server it is running the same scripts on. So you can't have a "weird line under the screen" except situations when the server passes some wrong output to the client. Some maps could fail to load due to rights management. If you run your server with an account called "xerox" (just an example), but add maps via your root account, all files created by root will be (depending on the file rights) non-readable and non-writable for the user, and of course your game server. You have to chown and chmod the files recursively and avoid using root account when not necessary. In other cases, there might be errors with other codes (e.g. local server has a module, but the VPS one doesn't have one, thus causing attempts to call functions which don't really exist), but that's trivial. Overall, if the codes are the same, the things act the same way too, unless there's something else what could affect other scripts' behavior
  2. Try to write the file into the subdirectory of your current resource like xmlLoadFile("files/helpmanager/help.xml") That's just security MTA provides (e.g. if you save login and password in an XML file, a resource on another server can't read it unless it has the same name. Even that can be protected by using @ before the name. Read https://wiki.multitheftauto.com/wiki/Filepath for further info)
  3. refreshall is slow and usually unnecessary. Use simple /refresh if you added a resource and didn't change others. It's much faster and more effecient.
  4. You can make a table of available players on the server, and when the client finishes downloading (when your script starts, onClientResourceStart with resourceRoot as the element) simply trigger server to add the client into the table.
  5. addEvent(name,true) clientside and then attach this event to a function. Make sure the player has downloaded all the files and scripts, so the event can actually be triggered.
  6. Instead of Md5, you can also compare their exact sizes. It's faster than Md5 if you compare a ton of pretty big files. Not as safe though (can be tricked, but i'm sure there's no-one to make a useful file with exactly the same size). But I'd stick to Md5 if I were you, just like Dealman said.
  7. Make sure this script is clientside.
  8. You can use element data events and undo all unauthorized changes.
  9. Pretty much any element data can be hacked. Never trust it.
  10. You created a table with stats as integer. Even if you try to save a table, it will still be integer. You can use string as table type and save tables with toJSON - read further with fromJSON.
  11. You can get countries only from external IPs. Your one is internal cause apparently the server runs in your local network.
  12. Maybe GTA resets those wheels back immediately. Try to put that in a render.
  13. table.sort is much slower than mysql sorting. Doing that in your queries won't affect performance, tested with 3000 rows with 40 columns.
  14. Something like this should do it: ALTER TABLE tops ORDER BY time ASC; (Change to DESC to switch sorting)
  15. Metatables give usual tables "special abilities" (Thanks to ixjf for the correcting me) (symlink to another table, lock itself, make some tasks simpler, create sandboxes). There is a dx library in default race resource, you can see how you can code OOP with metatables.
  16. Avoid using scale of any float value. It usually makes font quality really low. Use 1,2,3,... to keep it as good-looking as possible. So use something like math.ceil or math.floor together with resolution-based scaling and you should be good to go. If you need some really small text, you should consider importing a new font with really small sizes. But that doesn't change the fact that MTA can actually make fonts worse as far as it doesn't have font hinting.
  17. because your guiElement is just a string. You need an actual element and not a name. You obviously can't send a GUI element from the server because there's no such thing on the server.
  18. local val = tbl[math.random(1,#tbl)] -- get a random table inside local message = val[2] -- get 2nd argument which is your text outputChatBox(message)
  19. I'm pretty sure you can't replace exported functions without editing meta AND restarting the required resource. But you can always do that somewhere outside of that resource. Though you can make predefined exported functions and replace these functions in other resources so they call that resource. If you don't really need exports to get function results, you can simply use events + replaced functions in another resource. A replaced resource should look something like: function outputChatBox(text,player) return triggerEvent("outputChatBoxEvent",player,text,player) end That should be more flexible. If you really need replacements with dynamc exports and stuff, this should require MTA codebase changes.
  20. Serverside should be compiled if you share your file storage and don't want your scripts to be stolen/modified. What kind of priorities do you mean? All the resources run in the same condition
  21. It works only if the elements were created on the same side (client/server)
  22. local MTAIsCool = true -- we set it to be true if MTAIsCool == true then -- you can use "if MTAIsCool then" outputChatBox("Yeah, MTA is cool") else outputChatBox("You will never get this message in the chat") -- because MTAISCool is true end local MTAIsCool = false -- and now it's false if MTAIsCool == true then -- check again... outputChatBox("You will never get this message in the chat") -- because MTAISCool is false else outputChatBox("MTA is not cool anymore, eh") end local MTAIsCool = not MTAIsCool -- invert it from false to true (if it was true, it becomes false) if MTAIsCool == true then -- you can use "if MTAIsCool then" outputChatBox("Hell yeah, MTA is cool again") else outputChatBox("You will never get this message in the chat") -- because MTAISCool is true end
  23. There is no such thing as getting all world objects. They do not exist as elements. You can get all their IDs by simply getting IDs of all objects which could ever exist in GTA, that's pretty much it.
  24. I didn't even reply to your message. And it wasn't about stretching, by the way.
×
×
  • Create New...