-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
I am missing some of the functions. Also there is 0 documentation... Please use the default functions: local DBConnection addEventHandler("onResourceStart", resourceRoot, function () DBConnection = dbConnect ( "mysql", "dbname=DBNAME;host=HOST;charset=utf8", "USERNAME", "PASSWORD" ) if not DBConnection then cancelEvent(true, "Can't connect to the database.") end end) function query(...) local queryHandle = dbQuery(DBConnection, ...) if (not queryHandle) then return nil end local rows = dbPoll(queryHandle, -1) return rows end addCommandHandler("elo", function(plr, cmd) local id = getElementData(plr, "gameaccountid") if id then id = tostring(id) local data = query("SELECT * FROM characters WHERE account='" .. id .. "' AND cked = 0") if data then iprint("data", data) for i=1, #data do local character = data[i] iprint("character", character) local nick = character["charactername"] if nick then outputChatBox(nick) end end else iprint("no data") end end end)
-
No. The event system is a key component in MTA that should be well maintained. This is absolutely killing performance CPU as well as bandwidth: for theKey,players in ipairs(getElementsByType ( "player" )) do -- triggerServerEvent("sendMessage", localPlayer, localPlayer, players, message) -- end If you want to optimise this, then use 1 trigger event with a list of players. But still wasting bandwidth like this, will result in network issues and text delays. So my recommendation: - Do everything serverside. - Use this function to collect the players: https://wiki.multitheftauto.com/wiki/GetElementsWithinRange (Cube, not sphere) - Compare the distance as you were already doing for accuracy results. - add a spam filter - add a limit how many messages a player per second can send. - only display an X amount of messages per Xms, the rest will have to wait in a buffer. So that server lag will be limited to only text lag.
-
I am not sure what kind of software your are using, but it looks old. The fetch function normally would use a loop to fetch new data from the handler. But in your case I do not see an handler at all. query + make the request > Then start fetching as long as there is data with a loop. Are you able to connect manually to your db? https://wiki.multitheftauto.com/wiki/DbConnect Or can you provide some information about the socket/resource you are using?
-
The very reason the gui-Static-Image goes on top, is because you clicked on the bounding box of the image. To prevent clicking, disable the gui-Static-Image: https://wiki.multitheftauto.com/wiki/GuiSetEnabled
-
Oh lol, then you ran it on speedy mode. I wasn't sure if it loaded all collision fast enough so I put it on slowmode and it took ~3 hours to process ?, including the separated db queries as second process. (6k*6k, 2x2 grid) I7 3770k - 3,5GHz
-
How long did it take for you to complete the process?
-
Hmm interesting. Good job! Not so long ago I did the same. Scanning the whole GTA san map 2 units x 2 units and saving all points in to a db. All though my file was a lot bigger, containing not just the x, y, z.
-
You can resave the map root out of: https://wiki.multitheftauto.com/wiki/LoadMapData Or duplicate when loaded with the meta.xml: https://wiki.multitheftauto.com/wiki/GetResourceMapRootElement Good luck!
-
No, element-userdata-values are not elements. They are just references to the real elements and they are not re-use able when converted to a string. Use ID's to make that link. https://wiki.multitheftauto.com/wiki/SetElementID You could also save it as a map and load it as a map. local parent = createElement("vehicleParent") local vehicle = createVehicle(...) setElementParent(vehicle, parent) local file = xmlCreateFile("saved.map", "map") if file then saveMapData ( file, parent) xmlSaveFile ( file ) xmlUnloadFile ( file ) end https://wiki.multitheftauto.com/wiki/SaveMapData
-
Here: https://forum.multitheftauto.com/forum/87-resources/
-
There is 1 thing you can do, and that is to run your editor on a separated server. So that when you write your command, you reconnect to the other server.
-
Not possible with the current editor. Try to find an editor that is capable of that.
-
Running the editor parallel with a gamemode? Not with the default MTA editor atleast.
-
Not that I know of, but you can change the order. So instead of starting with a function, you could start with a multiline string. thisString = [[ function getName () end ]]
-
It seems everything is fine. You can't send loaded functions to the other side, because they are bound they their environment. The file and every variable around the function is part of the environment. If you actually could transfer functions, then Lua would also copy all other variables to the other side, in fact the entire Lua file. That would be catastrophic. local test1, test2 function test1 () local testValue = "test" function test2 () print(testValue) end end test1() I would recommend to use 3 files instead. 1 shared with all the functions inside of a table allStuff = { doThis = function () end, doThat = function () end, dontDoThat = function () end } 1 clientside function handlerFunction (key, ...) allStuff[key](...) -- client stuff end 1 serverside function handlerFunction (key, ...) allStuff[key](...) -- server stuff end etc.
-
1 amount = tonumber(amount) if amount then -- loop here else -- inform the user that he has to fill in the amount end 2 local size = table.size(playersT) There is no table.size, only table.getn or #. The source of following error Attempt to do arithmetic on a nil value, that occurs on line 18: local i = size + 1 arithmetic = mathematics: + - / * local size = table.getn(playersT) local size = #playersT
-
Keep it simple. if getElementModel(player) == tonumber(v) then break -- stop the loop when result end
-
Your table is empty, we can't validate that. Fill it up and than use this to visualise it: outputConsole ( inspect(enableGarageFunctions)) Open console (f8)
-
Just try to give it a root, because I am not sure if MTA, can detect multiple items and based on that create a new file root. (xml = fileRoot) <fileRoot> <policemen> <!--<user>(nazwaGracza)</user>--> <user>VaporZ</user> <user>maxeo11</user> </policemen> <policevehicles> <!--<vehicleicle>(idPojazdu)</vehicleicle>--> <vehicle>596</vehicle> <vehicle>523</vehicle> <vehicle>402</vehicle> </policevehicles> </fileRoot>
-
Aren't you saving userdata instead? Anyway, there are 2 things that I notice. 1. You are not unloading your xml file. But unloading 2 non existing files. 2. Your xml file doesn't have 1 root. It has 2 roots infact. @VaporZ
-
Is there a way to remove cars that are spawning in freeroam
IIYAMA replied to J4cobLIVEmain's topic in Scripting
Always English in this section. An addition translation in Polish is fine. Thanks you! -
In general it does matter. A function name is a variable after all. But for MTA(C++) functions you have to make an exception. For some unknown reason they are just as fast as localized functions. (I tested that a while back.) For self created functions, yes localized is faster accessible. Feel free to re-test it. Loop i= 1000 + getTickCount Note, this matters: (but not because it is localized, but because it pre-indexed) local tableRemove = table.remove
-
You do not understand that you have to go through an animation from 0% to 100% in order to even do the animation in the first place? ?
