
Overkillz
Members-
Posts
545 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Overkillz
-
Im already aware about that. But first, I want to create a simple light with X size and X colour. I won't attach it to my vehicle. That is a simple thing to do and I will leave it to the end.
-
Well, You gave me a great idea for other thing in a near future, however, this function didn't help me at all. Might I'm executing worngly the following function I tried to create a simple light on my vehicle position with a red colour, however, It didn't work. I tried to change the light type from 1-3 function createTheLight() local theVeh = getPedOccupiedVehicle(localPlayer) if theVeh then local x,y,z = getElementPosition( theVeh ) createLight(2,x,y,z,25,255,0,0,0,0,90,true) outputChatBox("Created Light") end end addCommandHandler("testlight",createTheLight)
-
I see, it work pretty good but, isnt there any other function that only modify tail lights ?
-
Hello dear community, well, Im so dump right now and I have forgotten a new function which was added to MTA some few months ago. It was the possibility to keep the vehicle tail lights ON even if the time in game was too early. I have been several minutes looking for this function at the wiki, sadly, I couldn't find it. Here some screen shots (Open the spoiler) if you don't understand me. As you can see, on the first picture the car is stopped, but on the second one the car is stopping.Thanks for reading
-
So, there is not any way that I can run those scripts ? Might converting to some format or something ?
-
Yes, I was already aware about doing a trigger but I wanted to avoid that. Luckily I could do it checking if the files was successfully teaDecoded and checking if the variable is a table. Looks like it works pretty good and I don't need to trigger it.
-
Thanks, I could fix it with the idea that u gave me. Otherwise, is there some problem with load and loadstring to not to laod copile scripts ? I have uploaded a map on my server which has copiled scripts and when I use load or loadstring functions it doesn't load the scripts.
-
Hello guys, well, my question is simple. Im saving a file on the client folder and it is teaEncoded. Well, this fille can be modified by the user writing on it ...etc However, I want to prevent this while it is read. My idea is to get the bool value using teaDecode. However, Im always getting that the file is Ok even if it is modified by the user (In this case me) Im not sure if you understand me. Here is my code function loadMapFromCache(wha) if wha then local pathMap = tostring("asd/dsa/"..wha..".wah") if fileExists(pathMap) then file = fileOpen(pathMap) if file then local fileR = fileRead(file, fileGetSize(file)) fileR = teaDecode( fileR, temporalTeaCode ) fileClose(file) if fileR then outputChatBox("Is Ok") else outputChatBox("Is wrong") end end end end end
-
Well, I couldn't be online to test the fix that you gave me. I implement it to the code and now looks like it works pretty fine. However, I needed to change the load function to loadstring and u suggested me before. Sadly, It doesn't execute the function. Here you can see the result of it (I added iprint to the loadScript to let you see water.lua | The water colour should be blue) function loadScript(scriptData) iprint(scriptData) hold("Called the loadScript function") local loaded = loadstring(tostring(scriptData)) local ex = pcall(loaded) hold("Called the load function.") if ex then outputChatBox("loaded the code") end end Thanks for helping me. Best regards.
-
First of all, thanks for bringing me a code which will help me alot in a near future. Well, respecting the code, I tried to test your coroutine function (I have never heard about this function before). Sadly. There is something wrong there. Here you have an screenshot about the problem Thanks for reading. Best regards.
-
Im already aware about that funciton. But what about if I want to the another one ?
-
I think I can't use it. The resource must be running and I haven't the resource running which contain that file. What does it mean? The file that I mentioned before isn't even on meta's resource Regards.
-
Instead of using fileDelete or adding cache="false" to meta.xml I recommend you to use Lua Compiler: https://luac.multitheftauto.com/ In my opinion its the best way to keep ur files secure. Yes, they can download the files, but they can't use them. I think this is the goal of it. Regards.
-
Hello dear community, Im here with a problem which is annoying me a lot. Well, Im using fileOpen, fileRead ...etc to save a file in cache folder. Well, I decided to save script files in cache and try to load them with a custom script loader, however, I couldn't do it. Im not sure what am I doing wrong. I started to do it with a simple script, however, I don't know what is wrong with the code. When I run it I get the game freeze and I need to task manager and force to close MTA Here is the code. Thanks for reading local filePath = ":theScript/temporalCache/mapTest/water.lua" function scriptReadaa() local file = fileOpen(filePath) if not file then error("Error opening File.") return end local data data = fileRead(file, fileGetSize(file)) iprint(data) fileClose(file) loadScript(data) end addCommandHandler("doit",scriptReadaa) function loadScript(scriptData) local simpleContador = 0 local Xfunction = load(function() simpleContador = simpleContador + 1 return scriptData end) if Xfunction then pCallPrev = Xfunction pcall(pCallPrev) else outputDebugString("Couldn't load the script") return end triggerEvent("onClientResourceStart", resourceRoot, getResourceFromName("SHIscriptloader")) end --##water.lua containts the following function function startclient() setWaterColor(0, 0, 255) end addEventHandler("onClientResourceStart", resourceRoot, startclient)
-
Sorry, my mistake. I was triggering a table from a client which wasn't empty. Thanks for answering. Regards.
-
The question is simple. Why it doesn't get empty only using tableExample = {} Well, I have a table, but when I want to clean it (Leave it empty) it doesn't work tableExample = { {"spawnpoint","425","3759.4814","-1384.124","7.75377","0","359.94","60"}, {"spawnpoint","425","3753.4814","-1387.124","8.75377","0","359.94","60"}, {"spawnpoint","425","3751.4814","-1382.124","9.75377","0","359.94","60"}, {"spawnpoint","425","3749.4814","-1389.124","10.75377","0","359.94","60"} } -- Why doesn't this work ? It should be enought to clean it right ? It still keeping the same spawnpoints if I update it by another table. tableExample = {}
-
Thanks for it, I have found the problem with ur help. When the objects were being added to the table, if they were false then they weren't added.
-
Hello dear guys, Im trying to use the following functions which are toJSON and fromJSON Well, I don't know when I use fromJSON I get some value changed. Why do I say this ? Well, in the table there are some booleans which will say if some objects will have "setElementCollisionsEnabled" or not. When I try to update the table from the file updated using fromJSON, collision is always false. That is an example. Sometimes the error is the position or something similar. I hope u can help me, thanks for reading. This error only happens when I use toJSON and fromJSON. (I bet that the error is on string.gsub) local tablaPrueba = { {"object","6959","3132.67969","-1632.39587","20.36549","0","90","0","0",true,"255","1"}, {"object","6959","3132.67969","-1632.39551","61.70512","0","90","0","0",true,"255","1"}, {"object","6959","3132.67969","-1592.40625","63.70512","0","90","0","0",true,"255","1"}, {"object","6959","3132.67969","-1592.40625","69.70512","0","90","0","0",true,"255","1"} } --CREATING THE FILE local fileHandle = fileCreate("tablaPrueba1.wha") if fileHandle then local json = toJSON ( tablaPrueba ) fileWrite(fileHandle,json) fileClose(fileHandle) end --LOADING THE FILE file = fileOpen("tablaPrueba1.wha") if file then local fileR = fileRead(file, fileGetSize(file)) fileR = string.gsub(fileR, "{", "[{") fileR = string.gsub(fileR, "}", "}]") fileR = fromJSON(fileR) tablaPrueba = fileR fileClose(file) end
-
Thanks, I didnt remember toJSON and fromJSON. It has helped me a lot. Thanks for it man. Best regards.
-
Hello dear guys. Im getting mad trying to solve this simple question. Well, I have a table like the following one and it has a value which is a boolean (The last one). Im trying to use table.concat to output them, however, it doesn't work. (I won't use quote characters inside the table. ) They can be used on output or whatever inside the code loop to output them local tablaPrueba = { {"object1","valor1","valor1","valor1"}, {"object2","valor2","valor2","valor2"}, {"object3","valor3","valor3","valor3"}, {"object4","valor4","valor4","valor4"}, {"object5","valor5","valor5","valor5"}, {"object6","valor6","valor6","valor6"}, {"object7","valor7","valor7",true}, } for i,objects in ipairs(tablaPrueba) do outputChatBox("{"..table.concat(objects,", ").."}")]] end Thanks for reading. Regards.
-
Well, I tried to do it but I didn't get u at all. This is what I have just tried local myTableA = {"Message1","Message2","Message3","Message4","Message5","Message6","Message7","Message8"} local tick = getTickCount() local duration = 5000 function dropMessages() for i,message in ipairs(myTableA) do if getTickCount()-tick>=duration/(i) then outputChatBox(message) end end end addEventHandler( "onClientResourceStart", getRootElement(), dropMessages)
-
Hello dear community. I have a simple question about loops. I have a table with several messages(it is an example), might around 1000. Well, here is my question, could I output them in X time. I don't know, something like all messages could be drop in 20 seconds 20000 ms / 1000 messages ? I know the simple method which is local myTable = { --[[ HERE ARE MY 1000 messages ]] } for i,message in ipairs myTable do outputChatBox(message) end I hope u can understand me. Thanks for reading. Regards.
-
Well, It could help me, but not at all. For example. If Im specting to some player who is in any vehicle and that vehicle has nitro and nitro is being used. If u switch to another player and switch back to the previous player and try to get the nitro level with the funciton GetVehicleNitroLevel you are not going to get the real nitro level. It gets restarted everytime. Thats why I want to use setElementData on a render (I want to do a draw with the real nitro level). Regards.
-
Hey dear community, today im here to ask you if I use setElementData and getElementData on a function which has as event onClientRender will give me problems ? I have used it but I would like to know everything about it. Thanks for reading, regards.
-
Are you aware that you need to restart the server after editing ACL.XML manually ? Remember that you can get the original ACL.XML with the following steps Shut down your server Remove ACL.XML via FTP or something similar Start/Run the server again. After running on the server again, probailly you need to restart it again to add your account to ACL.XML Regards.