-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
Yes, but in parts, as every part has to be build with precision. First try to get an understanding of the resource. https://wiki.multitheftauto.com/wiki/XmlData#Simplifying_the_export Then create a table format that could be used for the file management. For example: { [470] = { txd = "files/470/mod.txd", dff = "files/470/mod.dff" }, [...] = { ... } } You must create some functions that can create and update your format. I will give you more steps when this part is finished. Note, you shouldn't save your mods inside of XML. The file will get too big too quickly.
-
Yes that is happening. If you do not want that to happen, you have to do a lot more work. The first part is file management. "Which files does the client have downloaded?" You can use this resource for keeping track of the file locations and statuses. https://community.multitheftauto.com/index.php?p=resources&s=details&id=16187 And for writing the files: https://wiki.multitheftauto.com/wiki/FileCreate 1. Client [resource:xmldata] These are the files I have on my computer! > triggerServerEvent 2. Server These files are available to download. Filter out the files that have already been downloaded. > triggerClientEvent 3.Client Create new files fileCreate() and update the file management [resource:xmldata]. Yes, that is very much possible. triggerLatentClientEvent(player, ...) local handles = getLatentEventHandles (player) local handle = handles[#handles] local status = getLatentEventStatus(player, handle) iprint((status.percentComplete or 100) .. "%")
-
Did you debug the data?
-
getting better local col = modelDataList.col if col then local col_loaded = engineLoadCOL (col) if col_loaded then engineReplaceCOL (col_loaded, model ) end end local txd = modelDataList.txd if txd then local txd_loaded = engineLoadTXD(txd) if txd_loaded then engineImportTXD(txd_loaded, model) end end local dff = modelDataList.dff if dff then local dff_loaded = engineLoadDFF(dff) if dff_loaded then engineReplaceModel(dff_loaded, model) end end
-
Model and data? Where is that defined? The modelDataList from line 10 is what you have to send, when the server is finished with getting the data.
-
You are sending nothing. Maybe it is a good idea to send what you want to send. And is 10 seconds delay enough?
-
You can check the status of latent events. Also you might have bugged it (happend to me once), so restarting the client and the server. downloadFile doesn't work, as the files have to be initiated before the resource start. Without you can't even start the resource. Show serverside. Also keep in mind that you can't send files if they are not downloaded by the server yet. onPlayerJoin can't be used for players that are already in the server.
-
It probably it takes too long to transfer the data without changing the bandwidth settings. The triggerClientEvent is very aggressive and will be high prioritised as well as blocking everything else untill it is finished.
-
Just some inspiration, normally I do not write so much code on the forum, untested. -- INPUT local links = { { model = 560, txd = "https://cdn-20.anonfile.com/n9r7yfG3nd/e52c4b4d-1576530500/sultan.txd", dff = "https://cdn-07.anonfile.com/99u8y2G1n9/35d1852b-1576531060/sultan.dff" } } -- OUTPUT local modelDataList = {} -- local fileTypeLoadOrder = { "col", "txd", "dff" } do -- This is a temporary function. Only used for the initial state. local fileRequest = function (err, data, linkIndex, fileType) if (err) then print(err) end outputChatBox("Download started", root) local link = links[linkIndex] local model = link.model -- make a new container if not exist local modelData = modelDataList[model] if not modelData then modelData = { fileCountRemaining = link.fileCount } modelDataList[model] = modelData end -- save the data modelData.model = model modelData[fileType] = data modelData.fileCountRemaining = modelData.fileCountRemaining - 1 -- clean up if modelData.fileCountRemaining == 0 then modelData.fileCountRemaining = nil modelData.ready = true end end -- Loop through all the links for i=1, #links do local link = links[i] -- Keep track of the amount of files that need to be downloaded local fileCount = 0 -- Loop through all the file types in order. for j=1, #fileTypeLoadOrder do local fileType = fileTypeLoadOrder[j] local url = link[fileType] if url then -- If file type has an URL, then try to download it. fetchRemote(url, fileRequest, "", false, i, fileType) fileCount = fileCount + 1 -- + file end end link.fileCount = fileCount end end
-
Did you check the link with a (000webhost not logged in) browser? Yes, you can do that. But don't make the queue too long.
-
It is a limit. Timer are an async method. It requires a lot more work to keep temporary variables alive. So timers will make copies of the values rather managing the original values. - You can't pass functions in to a timer as argument. (They can't be copied) - You can pass tables in to a timer as argument, but they will become a (deep) copy.
-
Hmmm, maybe: currentEXP = totalEXP - requiredEXP
-
Debug line 50 and check if the value goes below 0.
-
I think the problem lies somewhere else. Try to debug your code with debug functions. Also check this: Clientside: addEvent("s_callback", true) addEventHandler("s_callback", root, function() triggerServerEvent("serverCallback", localPlayer, s_tarek) -- ???? end)
-
You are using the variable in onClientRender, before it even has a value assigned to it.
-
You made a typo. bodypart ( line 8 ) > bodyPart ( line 10 )
-
There are many. But if there is no issue, why changing the approach? If you want a different approach, it doesn't start with code, but with a concept and questions. How should the data be saved? And how should the data be accessed? Must it be dynamic? Must it be player specific? What are the conditions? What are the possible outcomes?
-
Locked, reason: scripting request. You can make requests here: (read the section rules before posting) https://forum.multitheftauto.com/forum/149-looking-for-staff/
-
For a scripter, yes. If you are looking for somebody that can create it, this is not the right section for that. See this section instead: https://forum.multitheftauto.com/forum/149-looking-for-staff/
-
You can't. It might be fake-able with propagation, but I don't think that is what you want. That is not going to work, the serverside function will not be able to apply the effect on an clientside element. What you need to do: Destroy the marker <--> recreate it.
-
Clientside created elements are not available on serverside. Those markers are already invisible for other clients/players as well as the server.
-
It is mainly used to break a big task in separated sub-tasks. Your computer can't finish the big task in one run without blocking everything else (other resources and applications like your browser). For example: You have to do 10 exams and for that you have write a script that would determine which exams you have to learn for. For learning each exam you need 4 hours. You are a human, so you need every day atleast 13 hours resting/sleep, breakfast, dinners etc. ----- No worries, you do not need to program this. But there is one thing that matters, which is that you can only finish 2.75 exams per day. In Lua there is also limit, just run this to find out: while true do end ------ Coroutines are used to pause the code when the duration takes to long. The timer is used to resume the code at a new moment. Now an impossible task can become smaller possible tasks.
-
I am just wondering, Mrtasty explained what the coroutine does. But do you also understand why they are used for something like bans? Temporarily stopping code isn't something you do without a good reason.
-
Limit is used to collect a maximal amount of results. This also allows your database to stop searching when you got the result you need. If you do not apply a limit. The database will keep searching (for example an account) even after finding it. Depending of the location of the data, you can reduce search time from 0% to 99%. LIMIT 1 If search based on row numbers: > 99% = target data is on the first row (the rest can be skipped) > 0% = target data is on the last row -------------- But in the example of MrTasty it is used to make sure that the returned table length can either be 0 or 1. Just to keep things simple. if #result == 1 then