-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
In that case you should also respect other people their time.
-
What you can change is learning the basics of Lua, so that you read code and understand that copying and pasting more advance code is not clever...
-
What is this entire topic all about if you haven't even wrote a single line of code? Also not even debug and validate the code in a single way? If you did not come here to script, please go discus this in a personal message with the one that did donate the code. This section is not for requesting free code, it is for learning how to code.
-
You could disable the element. https://wiki.multitheftauto.com/wiki/GuiSetEnabled
-
Triggers can't be deleted, only prevented by not trigger them.
-
No, but you might need to apply a delay between line 5 and 6, if you think it is necessary.
-
I see line 6 cancelling line 5? There is absolutely no logic in that. Did you call this function before you did that? (to put a stop to the rendering process) setCustomCameraTarget()
-
So you did this clientside: setCustomCameraTarget() On serverside you did this: setCameraTarget(player, player) What is the delay between those two actions? Did you try to apply them after each other with a delay of 2 seconds?
-
Which methods/implementations are use for that?
-
The issue is caused by not keeping an eye on state changing. The camera status can be changed by resources, but also by MTA conditions (for example dying). If you want to force setCameraMatrix you will need to repeat that process every frame to prevent any interruption. So you could create a resource which will manage all camera statuses and prevent any interruption. And even add extra custom ones. Like moving a camera from position to position.(cinematic effect)
-
You are 'thinking' that the variables are being send over, which is not the case. You can only send the data, which can gets stored in to new variables. Data goes in here: triggerClientEvent(source, 'ResultsDataB', resourceRoot, IN1, IN2, IN3); and come out here: addEventHandler('ResultsDataB', resourceRoot, function(OUT1, OUT2, OUT3) By using the same variable names, you can indeed pretend that you did send them over.
-
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.