-
Posts
6,085 -
Joined
-
Last visited
-
Days Won
215
Everything posted by IIYAMA
-
Compare filesizes, best way to validate if the file is incorrect. There is only 1 way to figure that out and that is to debug every step. And every variable that plays an important role. The update function is used to update the file, when you have replaced the old one with with a new one. This is something for the future. Line 70 is using the filepaths that are the old ones. Line 72 is delivering the new ones. Meta doesn't make use of include tag. <include resource="xmlData" /> Line 65 it's value should be set after onClientResourceStart.
-
Loop in line 26 is not required. Keep in mind that you might want to update 1 of the files instead of both. When you update/create the filepaths you also need to save the files. As well as saving the filepaths in the xml saving resource.
-
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.