-
Posts
6,084 -
Joined
-
Last visited
-
Days Won
215
Everything posted by IIYAMA
-
function acceptHeal() local requestStatus = getElementData(player, "healrequest") if (requestStatus == "pending") then setElementData(player,"healrequest", nil) -- delete it! setElementHealth(player, 100) outputChatBox("You have been healed by the doctor.", player) else outputChatBox("You have no pending request.", player) end end addCommandHandler("aheal", acceptHeal) Wrong named variables. addCommandHandler doesn't have the pre-defined source variable.
-
@N3xT Working <acl name="Default"> <right name="general.http" access="false"></right> <!-- add here --> <right name="resource.api-test.http" access="true"></right> <!-- ------- --> <right name="general.ModifyOtherObjects" access="false"></right> <right name="command.start" access="false"></right> https://files.fm/f/rtbmngd3 And if that file cache problem comes up: https://wiki.multitheftauto.com/wiki/FileRead https://wiki.multitheftauto.com/wiki/HttpWrite
-
@Galactix Please do requested code in a private message. Else people might think it is normal to request code in this section. I really appreciate your affords for the community!
-
Ah oke, still the same issue. I thought @MrTasty his input solved your issue. Coming back on that one (as I said before).
-
With JavaScript of course. Lua is not running in your web browser. https://stackoverflow.com/questions/19592009/html5-video-duration-without-playing-video
-
@MRThinker Please do not post these requests in this section. See section rules: Thank you very much and have a nice day.
-
Hmm, I didn't know you were using the file dynamic. https://wiki.multitheftauto.com/wiki/Resource_Web_Access See heading 》Parsed files 《 You can also build an API, which just reads the file and writes the web output. (With the given example you can already build it.)
-
Hmmmm, interesting. At the moment I do not have much time to test it. But in the future I might need to build an API for my server, so I am interesting in it too. Tomorrow or the day after that, I will write a test resource for this. So if you haven't figured out your issue by then, I will send you this test resource.(If it works xd) Of course I will be here for questions/support. Hang in there, Oke?
-
You can output your local server (side) debug information to your terminal. Which is in most cases already automatic.
-
》This works as with other ACL rights - You can enable it just for Admin users, or any other group of users you wish. 《 https://wiki.multitheftauto.com/wiki/Resource_Web_Access You might have to add it to the *.user group instead. Else it will indeed reconnect you.
-
To which group did you add it? And what happens if you stop the web browser resource? (Afaik it isn't required)
-
As I said before.That path can't be accessed, because it isn't public. MTA is the serving the files based on the meta.xml. And FetchRemote is for public web files only. Edit. Hmm I might be wrong about that. https://wiki.multitheftauto.com/wiki/Meta.xml Check out the html meta.xml tag. <html /> src: The filename for the HTTP file (can be a path) default: The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false) raw: The html file is not parsed by the Lua interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false) @N3xT More info about the path: https://wiki.multitheftauto.com/wiki/Resource_Web_Access
-
Ah oke, well you need a public web folder in that case. But keep in mind that a .map file is XML. And to read XML you need a file in order to use this function: https://wiki.multitheftauto.com/wiki/XmlLoadFile Don't make it harder than it is already. @N3xT The most secure thing you can do is to read the map file serverside. Convert it to a table format. Send it to clientside with triggerClientEvent and do what you want to do.
-
Why don't you use this instead? https://wiki.multitheftauto.com/wiki/DownloadFile fetchRemote has afaik not access to those files inside of a resource. Public web folder is required!
-
@SSKE Other methods next to table.insert to insert in to a table: -------------------------------------- -- Using the table more as an array -- -- manual insert zones[1] = "value" zones[2] = "value" zones[3] = "value" zones[4] = "value" -- Auto insert at the end. Does almost the same as table.insert, it just can't pushing items (from the first index) and it is much faster. zones[#zones + 1] = "value" -- #zones -- table length! -- #zones + 1 = new free slot! --------------------------------------- -- Using the table more as an object -- -- Dot notation zones.header = "value" zones.bodyText = "value" zones.subText = "value" -- The same without dot notation zones["header"] = "value" zones["bodyText"] = "value" zones["subText"] = "value" -- Using other values as index (yes no limits) zones[{}] = "value" -- table zones[2425] = "value" -- number zones["fdgsdf"] = "value" -- string zones[function () end] = "value" -- function --etc.
-
Element data isn't bound to dimensions, unless you control it clientside without sync it. A better solution would be: setElementData(element, "key" .. "_dimension:" .. dimension, value) setElementData(element, "key" .. "_dim:" .. dimension, value) Or: local markerContainer = createElement("markerContainer") local marker1 = createMaker(...) setElementDimension(marker1, 0) setElementParent(marker1, markerContainer) setElementData(marker1, "key", "345456") local marker2 = createMaker(...) setElementDimension(marker2, 1) setElementParent(marker2, markerContainer) setElementData(marker2, "key", "cgghgj") ------------------------------------------------------------------------- addEventHandler("onMarkerHit", markerContainer, function (hitElement, matchingDimension) if matchingDimension then end end)
-
A underline makes sense, because people understand that it means that the parameter has no purpose. But it is technically not skipping, as the underline is a variable after all. It just depends how you want to pass that information into the function. A single parameter that contains a table with multiple values works sometimes even better, because you can use it as an array(similar to parameters in a way) as well as an object.
-
@s2sk Skipping a parameter. function test (...) local parameters = {...} local variable1 = parameters[1] local variable3 = parameters[3] print(variable1, variable3) end test(1,2,3)
-
Nope, I am following the forum rules. The only thing I can do for you, is pointing you to the right information. Or helping you with the code you haven't written yet. https://wiki.multitheftauto.com/wiki/TeaEncode
-
You can do some stuff with MTA Lua functions, but you need to know Lua for that.
-
Well, lets first get back to basics. function () -- Yes We Can! end A function = something you can do. function shout() outputChatBox("Yes We Can!") end A function name = describes in short what the function does. `shout` setElementDimension We can set an element it's dimension, with `setElementDimension` local setElementDimension_ = setElementDimension We can now also set it with: `setElementDimension_` There are two variables `setElementDimension` and `setElementDimension_` that contain the same function reference. So why did I created another variable? setElementDimension_ Well, to make a wrapper. If you have for example a hamburger which you want to eat. Normally you can eat it directly, but now I wrap it up with some paper. Which means in order to execute the function `eat my hamburger` I also have to do the function `unwrap my hamburger`. I can case of a wrapper, you can execute both functions with just one function. Because it has to do more than it is already doing and you can't rewrite the native function. local setElementDimension_ = setElementDimension Re-save (wrapper function) function setElementDimension(theElement, dimension) -- ... end Overwrite the native function reference (only in the same resource) With these two steps I made sure that if I call the function setElementDimension, the wrapper function will be used instead. local setElementDimension_ = setElementDimension function setElementDimension(theElement, dimension) local result = setElementDimension_(theElement, dimension) return result end The next thing is to make sure that the wrapper function does at least the same as the native function. local setElementDimension_ = setElementDimension function setElementDimension(theElement, dimension) local previousDimension = getElementDimension(theElement) -- custom behaviour local result = setElementDimension_(theElement, dimension) -- custom behaviour if result then triggerEvent("onElementDimensionChange", theElement, dimension, previousDimension) end -- return result end Now you can customize your wrapper function. New behaviour: When ever you call the function setElementDimension in your script. The wrapper function will do the same thing + trigger the event onElementDimensionChange for it. With triggerEvent you can make a new custom event.
-
1. With a simple shader: https://wiki.multitheftauto.com/wiki/Element/Shader#Simple 2. Create shader: https://wiki.multitheftauto.com/wiki/DxCreateShader 3. Find texture names you want to replace: https://wiki.multitheftauto.com/wiki/Shader_examples#Texture_names 4. Create a texture of desert image: https://wiki.multitheftauto.com/wiki/DxCreateTexture 5. Set the texture to the shader with dxSetShaderValue https://wiki.multitheftauto.com/wiki/DxSetShaderValue 6.Apply shader to world: https://wiki.multitheftauto.com/wiki/EngineApplyShaderToWorldTexture
- 1 reply
-
- 1
-
-
Show us the code, which causes your filepath problem. And also keep in mind that image-pixels are not the same format as images. Which are both accessible by the dxCreateTexture function, but should approach differently.
-
Solve it from the source, since there is no native event. local setElementDimension_ = setElementDimension function setElementDimension(theElement, dimension) local previousDimension = getElementDimension(theElement) local result = setElementDimension_(theElement, dimension) if result then triggerEvent("onElementDimensionChange", theElement, dimension, previousDimension) end return result end (add this on the resources where you control the dimensions.)