-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
guiGridListAddRow(scoreBoardGridList, getTeamName(team), getPlayerName(v)) It is not very flexible, but you should consider each row an item with mutiple properties. If the two columns aren't related, then you need two gridlists. @majqq
-
1. Try to attach the checkboxes later than the scrollbar. 1. + 2. The scroll bar is on top of the checkboxes. And the checkboxes might be on top of the scrollbar. Which focusing on an element, the order might change. This is incorrect: (main issue) guiPanel[1] = guiCreateCheckBox(0.65, 0.1, 10, 10, "Show HUD", true, true, userPanel) guiPanel[2] = guiCreateCheckBox(0.65, 0.3, 100, 100, "Show GPS", true, true, userPanel) guiPanel[2] = guiCreateCheckBox(0.65, 0.5, 100, 100, "Show Debug", true, true, userPanel) guiPanel[3] = guiCreateCheckBox(0.65, 0.7, 100, 100, "Low blood effect", true, true, userPanel) guiPanel[4] = guiCreateScrollBar(0.02, 0.3, 0.60, 0.070, true, true, userPanel) guiPanel[5] = guiCreateScrollBar(0.02, 0.5, 0.60, 0.070, true, true, userPanel) guiPanel[6] = guiCreateScrollBar(0.02, 0.7, 0.60, 0.070, true, true, userPanel) guiPanelTexts[1] = guiCreateLabel(0.14, 0.23, 30, 30, "Weapon sounds", true, userPanel) guiPanelTexts[2] = guiCreateLabel(0.54, 0.23, 30, 30, "100%", true, userPanel) guiPanelTexts[3] = guiCreateLabel(0.14, 0.43, 30, 30, "Actions sounds", true, userPanel) guiPanelTexts[4] = guiCreateLabel(0.54, 0.43, 30, 30, "100%", true, userPanel) guiPanelTexts[5] = guiCreateLabel(0.14, 0.63, 30, 30, "Radio sounds", true, userPanel) guiPanelTexts[6] = guiCreateLabel(0.54, 0.63, 30, 30, "100%", true, userPanel) 30 = 3000% 100 = 10000% @majqq = 100000000%
-
Saving??????? This is about loading! Maybe you use it like this: local trabalhotr = playerTraficante[source] I have 0% knowledge about your system. You should know that better than me.
-
As @Overkillz said, you can wrap Lua(tables in tables) and in JSON (objects/arrays in objects/arrays). Or, you can use XML to manage the JSON/tables as I said before.
-
playerTraficante = {} Is a table, tables can't be called. playerTraficante ( ) Only functions can be called. The reason why it is table instead of a function is unknown to me. Please ask the one that created the script for the reason why. Or if it is created by yourself, then ask yourself the same question. Also it might be handy to inspect the table first. iprint(playerTraficante) It might give you information about how to use it.
-
yes, every time you are going to write.
-
@ryders Try to use this function. (read the wiki carefully) https://wiki.multitheftauto.com/wiki/SetOcclusionsEnabled It needs to be is a script.
-
Might be the reason for writing incomplete data. The file isn't flushed, so it might handy to do that as well: https://wiki.multitheftauto.com/wiki/FileFlush Oh and empty(recreate) the file each time you start writing data. @majqq The file is incorrect. There has been double written as you can see. (from a few moments before) se ] ] from: false, false ] ] Clean the file and try again.
-
@majqq That is a perfect result! (debug) But this will write too much JSON:
-
It looks fine, except for: (not sure if it is your typo) [ [ false, false, false, false, false, false, false, false, false, false ] ]se ] ] What happens if you debug: jsonData ? @majqq P.s don't forget to clean the file before testing again. Oh and use resourceRoot for the even handler ?
-
Is it possible to load 2 different types of mods on the same model?
IIYAMA replied to FlyingSpoon's topic in Scripting
Most likely. Unless that person is really good with shaders and can do it without. But I have never created a shader in my life, so I do not know their limits as well. (Which is of course also limited to the hardware, but textures and objects will work on 99%of the video cards unless they run out of vram.) -
Is it possible to load 2 different types of mods on the same model?
IIYAMA replied to FlyingSpoon's topic in Scripting
One of the two points I noted before and most likely a combination of both. (You can attach objects as well to peds with bone attach resource) -
@majqq Oke let me explain you the difference between Lua tables and objects / arrays in JavaScript. (JSON = JavaScript Object Notation) Here we have a table with array structure in Lua: local thisArray = {1, 2, 3, 4} Here we have a table with object structure in Lua: local thisObject = {a = 1, b = 2, c = 3, d = 4} Here we have a table with an mixed structure in Lua: local thisMix = {a = 1, b = 2, 3, 4} As you can see those are tables. There is no such thing as arrays or objects in Lua. But if we were to transform them to JavaScript: Array const thisArray = [1, 2, 3, 4]; Object const thisObject = {a: 1, b: 2, c: 3, d: 4}; There is NO mixed in JavaScript! If you insert a mixed Lua table in JSON (JavaScript Object Notation), the structure will be an OBJECT ? Afaik this is what is happening to you, except it doesn't look like you are doing the same thing... local thisMix = {a = 1, b = 2, 3, 4} To JSON .................... From JSON local thisMix = {a = 1, b = 2, ["1"] = 3, ["2"] = 4} -- or local thisMix = {["a"] = 1, ["b"] = 2, ["1"] = 3, ["2"] = 4} So how about try it without defining any keys. Because I really have no other idea why else it would change it to an object. playerData = {playerItems = {false, false, false, false, false, false, false, false, false, false}}
-
Is it possible to load 2 different types of mods on the same model?
IIYAMA replied to FlyingSpoon's topic in Scripting
Technical it is not possible. The rule is: 1 model, per 1 model ID. There is only one thing that can overrule the visualization in game without changing models and that is: `shaders`. Unless you find somebody who is a professional with shaders + willing to help you, it will remain an impossible. Another approach I have seen before to create custom cars, is by attaching custom objects to the vehicle which look like vehicle components. That will require a good modeller. -
As I mentioned before, do not mix arrays and objects in same table in Lua. For some unknown reason that has happend here. The json I am looking at contains an object instead of an array. Object: { } Array: [ ] Try to not assign the items to specific indexes, but keep it untouched. In your current code the items can be accessed using a string "1", "2" etc. Use: iprint to figure out more info.
-
Might be possible, as long as it is detected by MTA. Not all animations are for some unknown reason detected. Just test it!
-
It is less efficient because: - Tables are a very different format than XML. That means that you have to write and convert the data with a lot more extra code. - It isn't compact, the filesize will be a lot bigger incompare to JSON.
-
I noticed that I haven't gave you an useful examples. @majqq Well here you have an example of: B In OOP. Not MTA OOP, which I do not like, but pure Lua OOP. And see how the magic does it's job. local newTable = enchantedTable:create() newTable:add({type = "yes", 1, 2, 3, 4}, {type = "no", 5, 6, 7, 8}, {type = "no", 5, 6, 7, 8}) -- add three items local collection = newTable:get() -- get the whole collection print(collection[1]) -- get the first print(collection[2]) -- get the second print(collection[3]) -- get the third -- Getting the result of the item records. print("all: ", newTable:count()) -- count all: 3 print("`yes`: ", newTable:count("yes")) -- count only type `yes`: 1 print("`no`: ", newTable:count("no")) -- count only type `no`: 2 newTable:remove(2) -- remove item 2. print("`no`: ", newTable:count("no")) -- count only type `no`: 1 When using this code you can easy extend functionality a long the way. Just adding methods to the methods-table and new functionality opens up to you. But remember, do not modify the collection (of the items) without using these functions, or the registration will not be able to get track of the item count.
-
XML has most of the cons. It is also much older, so it is to be expected. There are a few XML haters on the community, so I will keep it short. So a few pro's: - Readability is very high, especially in case of inheritance. In JSON that can also be good, but you will need a proper reader for that. - Maintenance. In case of breaking it, it is very easy to fix it. (That being said, it breaks easier if you do not know the rules.) - Saving JSON inside the notes and keeping a secondary XML layer of properties that do not have to be saved in your main data. There are not many user cases where you want that on clientside. Unless you have a shared settings file for all resources. In that case you only have to parse JSON of a specific resource node. - (not related to player settings) Can be use for multiple files that are already integrated in mta. XML, map, (acl*) So JSON? Yes, if you keep your lua table it's structure: arrays and object separated.
-
Tables that are 'saved' inside of other tables do not become a different tables. So no, there are no better solutions, except if we optimise it for the code around it that is going to use it. This matters: - The frequently + when which operation of the table is used. If we ignore the types of methods to accomplish our goal, and only look at which options there are: A: Check every items and find out the information we need. B: Keep a record of which types of items we are adding and removing. Which one is better? That depends on the frequency which part of the code is used. There are two parts: 1. Modifications of the table. 2. Reading the table.(item count) (More table modification, than reading the table, pick option: A) (More reading the table, than table modification, pick option: B)
-
I recommend to copy the editor dumb file in that case. It should contain the most possible recent map content of the map that doesn't want to be saved. Bring the content of that file to the forum to debug the xml structure. (I have fixed map files before)
-
With a loop, as you are already doing. Or use a meta table on top of your table, which can be used as `firewall` + to keep track of inserted item counts. If you need an example for that, feel free to ask. Meta tables can be a bit confusing and I most of the time try not to use them as they can executing a lot of functions for just simple operations.
-
Shouldn't "onClientPreRender" + setCameraMatrix fix the job? The wasted camera effect is a delayed effect. It occurs not imidiatly, but after a few frames. Also I do not know if the effect is just one frame or multiple. Another possible way could be attaching the camera to another element. But no guarantees.
-
Not sure if this works: https://wiki.multitheftauto.com/wiki/OnClientMouseMove Attach it to the gridlist. + -- doing some cursor position recalculation ... -- ... -- some more till you get the inner bounding box of the gridlist + https://wiki.multitheftauto.com/wiki/GuiGridListGetRowCount math.ceil(cursorInBoxPositionY / boxHeight * columns)
-
How would you reproduce that? Based to a quick look to your code that should be fine. Unless something is not working etc. See also this function: https://wiki.multitheftauto.com/wiki/GetKeyState
