-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
triggerClientEvent(source, 'ResultsDataB', resourceRoot, rowID1 ); And debug with iprint. addEventHandler('ResultsDataB', resourceRoot, function(rowID1) iprint(rowID1)
-
Wrong base element provided. See: addEventHandler('ResultsDataB', resourceRoot, function() This event will only trigger when the resourceRoot is provided or a (+n indirect) child of the resourceRoot. A player is not a child or an indirect child of the resourceRoot. See: (players blue and resourceRoot purple) So to solve that issue. triggerClientEvent(source, 'ResultsDataB', resourceRoot, result1);
-
Yes and no. It does have some limitations, when it comes to multiple resources. You can't assign children to parents of different resources. A possible way around: Resource 1 local vehicleParent = createElement("vehicleParent") local newVehicle newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) Resource 2 local vehicleParent = createElement("vehicleParent") local newVehicle newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) Resource 3 local vehicleParents = getElementsByType ("vehicleParent") -- getElementChildren doesn't work at this first line, because those elements are not direct children of the root element. for i=1 #vehicleParents do local vehicleParent = vehicleParents[i] local vehicles = getElementChildren ( vehicleParent, "vehicle" ) for j=1 #vehicles do local vehicle = vehicles[j] end end
-
Good question. Yes it will get all vehicles by default. There is one thing that I do not know and that is: "Will vehicles in a different dimension be considered as streamed in?" Because getElementsByType does have a setting that allows the user to only collect streamed in vehicles. Which is incredible useful to improve the performance of the script. But if you need all streamed out vehicles as well, it might not be a good solution. https://wiki.multitheftauto.com/wiki/GetElementsByType Syntax (clientside) table getElementsByType ( string theType, [ element startat=getRootElement(), bool streamedIn=false ] ) Capturing only streamed in vehicles. local vehicles = getElementsByType ("vehicle", root, true ) A different method, but has to be partly implemented on the resource that creates vehicles. (not recommended unless you know how to to work with the element tree) local vehicleParent = createElement("vehicleParent") local newVehicle newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) newVehicle = createVehicle ( 551, 0,0,0 ) setElementParent(newVehicle, vehicleParent) setElementDimension(vehicleParent, 100) -- move all current vehicles to a different dimension (fun fact) Getting only these 3 vehicles. local vehicles -- vehicles = getElementsByType ("vehicle", vehicleParent) -- or vehicles = getElementChildren ( vehicleParent, "vehicle" ) -- the difference: This function only captures the direct children of the parent 'vehicleParent'. But in this set-up it doesn't matter. Else you might need an utility function, like this: function filterElementsByDimension (elementList, dimension) local newElementList = {} for 1, #elementList do local element = elementList[i] if getElementDimension(element) == dimension then newElementList[#newElementList + 1] = element end end return newElementList end
-
Yes, just not by default. ---------- The website that originally contained the resource that could do that is gone because the owner crystalMV did quit MTA, but it seems a copy of it is still stored in the website archive: https://web.archive.org/web/20160507103732/http://crystalmv.net84.net/pages/scripts/server_coldata.php
-
Even after you received my warning, you are still continuing with bumping 2x. The content of those messages are not useful in anyway and very annoying for everybody, therefore I consider them as spam. https://forum.multitheftauto.com/topic/120659-help-stringfind/?do=findComment&comment=966942 https://forum.multitheftauto.com/topic/120659-help-stringfind/?do=findComment&comment=967139 Locked
-
How to make a Ped enter a Vehicle by getting close to it?
IIYAMA replied to Kraig Hellsing's topic in Scripting
I cleaned up your first function a bit. function reward(vehicle) if getElementType ( vehicle) == "vehicle" then local player = getVehicleOccupant(vehicle, 0) if player then givePlayerMoney(player, 1000) outputChatBox("Perp has been turned in and you earned $1000!", player, 0,255,0) destroyElement(source) -- destroy the marker, source of the event: addEventHandler("onMarkerHit", policem, reward) end end end function createPoliceMission () local policem = createMarker(1586,-1677,5, "cylinder", 5, 255, 0, 0, 170) addEventHandler("onMarkerHit", policem, reward) end createPoliceMission () -
If you do not understand the problem yet, how do you know that you need a function for repair? I understand that you are a new scripter, but not understanding the nature of the function you are trying to fix is not handy. The function is used to detect bugged accounts. Fix therefore the issue rather than the function that checks if issues occur.
-
Absolute/Relative GUI/DX Resolution Scale Positioning
IIYAMA replied to ReZurrecti0n's topic in Scripting
This one: https://wiki.multitheftauto.com/wiki/GetChatboxLayout -
Absolute/Relative GUI/DX Resolution Scale Positioning
IIYAMA replied to ReZurrecti0n's topic in Scripting
Hmm, I was never angry. But my words choice might be a little bit incorrect. My apologize for the inconvenience. I meant: Don't be afraid to just copy, it will save you time. If it works, you can analyse it later. Keep up the good work! -
Absolute/Relative GUI/DX Resolution Scale Positioning
IIYAMA replied to ReZurrecti0n's topic in Scripting
If you didn't post this topic, you wouldn't have access to a possible solution. But not scrolling down the page to the replies, (most of the time a gold mine), is actually something you should consider doing next time. ? -
Absolute/Relative GUI/DX Resolution Scale Positioning
IIYAMA replied to ReZurrecti0n's topic in Scripting
My reply on that same topic, might give you a hand in figuring out how position things on the screen. Everything is already ready for you to copy and past. Please be lazy for once in your life. See: -
Absolute/Relative GUI/DX Resolution Scale Positioning
IIYAMA replied to ReZurrecti0n's topic in Scripting
Yes, I wouldn't agree more. Also this one? Because afaik the issue lies more with width of the element, which will result in a wrong button position. \/ Your relative function is not suited for pixel perfect designs. It is only useful to get the job quickly done. [Note: I am currently very busy, so will not be able to create examples for you] -
https://wiki.multitheftauto.com/wiki/TestLineAgainstWater A line that detects the surface of the water. I am sure that you are creative enough to make it with that function.
-
Use timestamp. Check the docs. And no I currently can't give any examples as I am extremely busy with a real life project that is killing all the hours I have. Please ask somebody else.
-
This is a memory leak, most likely created by one of your scripts. Use the performance browser to find the responsible resource: (Category - Lua memory???) https://wiki.multitheftauto.com/wiki/Resource:Performancebrowser Best of luck
-
With: https://wiki.multitheftauto.com/wiki/SetElementFrozen
-
@SuperM Open your map file in your text editor. Search for the id. And give the node the attribute: frozen="true". (Check if the attribute is already added) Add it like that: (don't copy/past) <object frozen="true"></object> https://wiki.multitheftauto.com/wiki/Element/Object
-
@XaskeL Unfortunately I can't answer this question. But one thing I noticed is you are making it too complex and putting stress on your MTA application. If you want to read and write pixels, why not let a secondary application take care of that? You are just blocking your MTA thread after all. https://www.npmjs.com/package/@rgba-image/pixel https://www.npmjs.com/package/get-pixels (Also you might find an answer to your question in the source code of those two node applications) Do with it what you want, best of luck!
-
This information might also be useful for you: local x, y, z = 0, 0, 10 local rx, ry, rz = 0, 0, 0 -- test rx, ry, rz = (rx + math.random(3)) % 360, (ry + math.random(3)) % 360, (rz + math.random(3)) % 360 -- local m = createMatrix(x, y, z, rx, ry, rz ) local startX, startY, startZ = getPositionFromMatrixOffset(m, 0, 1, 0) local endX, endY, endZ = getPositionFromMatrixOffset(m, 0, -1, 0) local faceTowardX, faceTowardY, faceTowardZ = getPositionFromMatrixOffset(m, 1, 0, 0) (functions are on that topic)
-
For this you indeed need to use dxDrawMaterialLine3D. This is actually not the right section for details about COLS (collision files). (unless it is only for the replacement code) You will have more luck with that in: https://forum.multitheftauto.com/forum/177-modelling/ + you can figure out which people have knowledge about it.
-
Are you going to create lights under the ped his feet? Or a shadow as image? Hmmmhmmhmmmmm Could work, but it is still not clear what the ultimate goal is. Btw. See also this function: https://wiki.multitheftauto.com/wiki/ProcessLineOfSight It it doesn't only tell you if the line is clear, it also detects the collision position. (And much more: material, surfaces orientation, vehicle parts)
-
See also: https://wiki.multitheftauto.com/wiki/OnPlayerContact
-
@playerpocket https://forum.multitheftauto.com/forum/127-programação-em-Lua/ General MTA > Other languages > Portuguese / Português > Programação em Lua = https://forum.multitheftauto.com/forum/71-scripting/ MTA Community > Scripting (+ Língua portuguesa) = Thank you, IIYAMA
