-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
Text on a texture? https://wiki.multitheftauto.com/wiki/DxCreateRenderTarget
-
No, I do not see the errors you have. (in console) https://wiki.multitheftauto.com/wiki/OnClientElementDestroy is not cancel able.
-
Image not working. @JeViCo
-
You can script C++ within modules. https://wiki.multitheftauto.com/wiki/Modules But there are not so much people that are making use of that, as lua is so much more flexible and in MTA resource based. With other words, do not expect much support in this matter. If you know C++ then I am very sure you will not have much trouble with lua.
-
If the break keyword is used directly inside the loop you want to stop, then yes. ---- -- works for ... do for ... do break end break end ---- ---- -- does not work for ... do for ... do break break end end ---- If your code works, then first run a speed test. (So you can actually see if your speed improves with every action you take. local timeNow = getTickCount() for speedTestIndex=1, 1000 do -- <<< put your code in here end local endTime = getTickCount() outputChatBox("code duration: " .. (endTime - timeNow)) Write down below your code how long this took. (It is best to run the test twice per code) Improvement your code: - use the basic for loop, instead of the ipairs loop and test again. (The same type as the one of the speed test) Note: this code does not test for double items, is that a must?
-
@Flower ☠ Power More RAM? I am not sure. ElementData has as nasty after effect that, the data remains in the memory (even the server) after it has been set. This has to be cleared manually. Stopping a resource doesn't clear it, unless it is applied to a >destroyed< element of that resource. But it might be true that the triggerEvent uses more RAM while being executed, as it is a more direct method. If you trigger from one side to another side (without latent events), you will notice that it is a high priority network request, while elementData is being send/received after a (few) frame(s). << not sure how elementData is prioritised. I haven't been in to the development of MTA, so keep in mind that there might be other explanations for these results, as everything that I am saying is based on my own experience.
-
Trigger events will use around 3 t/m 7 times more network(I do not know the exact multiplier) per player incompare to elementdata. * send tables over without much impact on the network. * can indeed be send to specific players. * do also have a latent variant which doesn't block the network. * require more code to sync. Elementdata * is a logic method to add properties to an element. (Which has more or less to do with the name of functions) * always synced with all players A single * execution of a single connection has relative low impact on the network. Player > server * each set counts as an update of the server and the other clients. (CPU) Both methods trigger the event system. Just specific trigger events should technically trigger specific clients only. (specific performance details of the cpu are not known by me) So pick which you think that is right. Thought, I wonder if using the UDP protocol through a browser might be using the lowest amount of data.
-
Tag can't start with a number. Rule nr.4: http://www.adobepress.com/articles/article.asp?p=1179145&seqNum=4 (There are all 9 rules on that page) Also a XML validator will tell you where an error might be located: https://www.xmlvalidation.com/index.php Last note: Try not to use custom tags based on your data. Pre-sets of tags like col, txd and database are fine. The methods you should use for custom data are: <tag>value</tag> and attributes="..."
-
Ever seen a meta table as they are created? A meta table is used to change the behaviour of a regular table. The main issue is with the fact that it uses functions to achieve this behaviour. And functions... Optional Arguments NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments. sendTo: The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. This argument can also be a table of player elements. arguments...: A list of arguments to trigger with the event. You can pass any lua data type (except functions). You can also pass elements. https://wiki.multitheftauto.com/wiki/TriggerClientEvent ...can't be send over according to wiki. But even if this is a meta table, you will have the same problem with a regular table. This has probably happend: all the functions that are inside of the table are deleted.
-
The most fast methods are very dirty. I will only explain those ones when I think you have learned enough from the clean ones. But make one first. Just two loops, one nested in to the other. And try to figure out what the most logic human method would be to achieve your goal. If it fails, don't worry, just post what you tried. But it has to be yours, only then I will help you.
-
Debug your code? https://wiki.multitheftauto.com/index.php?title=Debugging Learn the basics of lua? Write down what all functions do? (in order to understand what the code does) You could do that.
-
getAttachedElements (vehicle) This returns a table with attached elements. #table # gets the length of a table. value > 0 This returns true or false depending if the value is higher than 0. local serin = result This saves the result in to serin.
-
A very quick and basic solution, would be: local siren = #getAttachedElements (vehicle) > 0 Place it where you think it would make sense in your code. And if you do not know where to place it, you can always try it at all 24 lines till the code finally does what you want... ? @Ekko
-
I still have no clue which one of the two you mean. Heli rotors switch (90-degree) = model ( ask somebody who edits GTA models ) Heli rotors animation (360-degree propeller rotation) = texture + shader ( ask somebody who create shaders, they are easy to find if you search for shader resources )
-
With something that can calculate world positions to screen positions: https://wiki.multitheftauto.com/wiki/GetScreenFromWorldPosition What does this function do? getScreenFromWorldPosition \/ get - screen - from - world - position \/ Get a screen position from a world position. \/ World position = screen position
-
I based that information on your code, as you said it only works for the hydra. The hydra does have an adjustable property, a beagle does not. That is just a feature from GTA. Yet, I am very sure that somebody can script this effect for the beagle as well. Just it probably cost a lot of $...
-
Because it is programmed like that. 511 is the vehicle ID of a hydra. https://wiki.multitheftauto.com/wiki/getPedOccupiedVehicle Feel free to program it to how you think it is suppose to work.
-
If we are talking about custom bullets, then yes. For regular bullets use: https://wiki.multitheftauto.com/wiki/OnClientPlayerWeaponFire @majqq
-
If you do not know lua, then I can imagine that... lua first, no ifs and buts about it.
-
There are two(three*) functions that can detect things between two points, which you could describe as "line detection". A line would be similar to a flying bullet. https://wiki.multitheftauto.com/wiki/IsLineOfSightClear https://wiki.multitheftauto.com/wiki/ProcessLineOfSight * Water detection.
-
The only thing you should be aware of is that you can't give it the same values. if value1 == value2 then return value1 end Something like this would solve that. (Place it directly after line 1)
-
I do not understand your problem. If you are not inside of the vehicle, how else do you want to figure out which vehicle you want to modify? The current code clearly is build to support the vehicle owner only.
-
function getRandomValueBetween (value1, value2) -- Be different! ;o local difference = value1 - value2 -- Be positive! :D local positiveDifference = math.abs(difference) -- Be ra ndo m! local randomPositiveDifference = math.random(positiveDifference) local randomDifference if difference < 0 then -- Be negative :( randomDifference = -randomPositiveDifference else -- Stay positive! :DDDD randomDifference = randomPositiveDifference end return value1 - randomDifference end -- Be famous print(getRandomValueBetween(-10, 10))
-
Doesn't look like a ped to me. That script works sort of the same as this headshot script: (You only have to edit it) https://community.multitheftauto.com/index.php?p=resources&s=details&id=1600 Which is very dirty way of deciding when somebody gets hit. Unfortunately some people do have so much lag/de-sync that they can't play the game without it... (not that they can help it ?)
-
-- Be a number #1 local value1 = 10 local value2 = 100 -- Be different! ;o local difference = value1 - value2 -- Be positive! :D local positiveDifference = math.abs(difference) -- Be ra ndo m! local randomPositiveDifference = math.random(positiveDifference) local randomDifference if difference < 0 then -- Be negative :( randomDifference = -randomPositiveDifference else -- Stay positive! :DDDD randomDifference = randomPositiveDifference end -- Be famous print(randomDifference) Not sure if there is an easier way, but this is a way to calculate it. Not understanding what the math.abs method/function does? Watch video: https://www.khanacademy.org/math/arithmetic/arith-review-negative-numbers/arith-review-abs-value/v/absolute-value-of-integers
