Jump to content

IIYAMA

Moderators
  • Posts

    6,086
  • Joined

  • Last visited

  • Days Won

    215

Everything posted by IIYAMA

  1. IIYAMA

    LOCKED

    Reducing 8 similar loops to 1 loop is unclear? Really? Momentarily you are giving me the feeling that you do not understand your own script, which is a big issue.
  2. @JeViCo Once you change the file, it is no longer valid for MTA and will be re-downloaded.(your previous problem, which is related to file security) Please show me your code. Because it looks like you either didn't close the file in time or deleted it too fast.
  3. That doesn't happen for me. Are you editing the files or something like that? (Or doing this before the resource has started?)
  4. IIYAMA

    LOCKED

    I am sorry, I do not play CIT. Please make some of your own adjustments first based on my feedback, before you give it to somebody else. That is the least thing you can do in order to understand your own mistakes.
  5. IIYAMA

    LOCKED

    Every time you press a key. function Switch(button,press) -- yes here end addEventHandler("onClientKey", root, Switch) = You create a new function/functions with an addEventHandler attached to it. With other words, you created a memory leak by doing this: addEventHandler("onClientKey", root, function (button, press) if button == a[0] then if (press) then if wep == 0 then setPedWeaponSlot(localPlayer, z+1) else setPedWeaponSlot(localPlayer,0) end end end end) For every next click you execute those addEventHandlers * times you clicked. The longer you are doing this, the more lag it creates. You are having 8 loops that execute 13 times. 8 * 13 = 104 looping. for z= 0,12 do -- yes this 8 times. end How about you just use 1? I do not even know how it is suppose to work, so I am not going to rewrite your code. What I do recommend you to is write very clear how your code is suppose to function. And write down which steps the code has to take to achieve it's goal. >>> Writing a new unknown functionality without defining it's steps is bad practice. (Unless you have written something similar before) <<< Not everybody agrees to this, that is fine.
  6. I assume you already moved on. But for the next time Open the editor dump file(in resources) and check if anything is left in it.
  7. <object name="resource.admin2"></object> * (just as what Overkill said) Or rename the resource folder `admin2` to the original name: `admin`.
  8. Yes, more than enough. And if you want to be 100% sure, you can check the wiki logs and find the person that wrote the comment + ask him/her yourself.
  9. If you did use OOP, then you would be overwriting the MTA classes. https://www.lua.org/pil/16.1.html > It should be fine as long as you do not use OOP or overwrite predefined variables. https://wiki.multitheftauto.com/wiki/Predefined_variables_list Be aware that other people who do use OOP and want/need to edit your resource will be having a hard time. So no worries, just but be consistent in your code.
  10. https://wiki.multitheftauto.com/wiki/OnClientVehicleCollision https://wiki.multitheftauto.com/wiki/SetGarageOpen
  11. See example on wiki: https://wiki.multitheftauto.com/wiki/SetLowLODElement
  12. arenaSrv.timers[i] = nil -- OR -- outside of the loop arenaSrv.timers = {} -- reset the table You have remove it from the table. Nilling a variable is not the same.
  13. IIYAMA

    damageTimer

    Mistakes: 1. You didn't save your timer. + A timer isn't the same as table. 2. If you set the element data to "no" before you set the timer = it has no function at all. You might consider remove it.
  14. math.floor(value / 10 + 0.5) * 10 This round based on 10. (Inspiration) __________________________________ Experimental local value = 342 local restValue = value % 5 print(restValue) if restValue > 2.5 then value = value + 5 - restValue else value = value - restValue end print(restValue) print(value)
  15. Google is smarter than me. https://stackoverflow.com/questions/45259879/how-do-i-remove-all-special-characters-punctuation-and-whitespaces-from-a-strin
  16. Are your queries limiting the search result? (Just check it if you haven't done it yet, because not doing it can improve the performance with 0 t/m 1000% depending on the situation) 1. Limit search results Your situation: queries are taking too long to complete and your lua memory is waiting for the results.(because you didn't use callbacks) 2. Use callbacks instead of pause the lua memory. 2.1 See also coroutines: https://www.lua.org/pil/9.1.html 3. Last resort You have to queue your queries and let it better work with your internal lua memory.
  17. IIYAMA

    Hex problem

    There are already two hex values inside of the string. They will be dominating the colour.
  18. You may can up-scale it with a tool like this: https://vectormagic.com/ (desktop version for higher resolution -> trial) But of course the result is not 1/1.
  19. IIYAMA

    Vehicle Dmg

    For ramming you can edit those: https://wiki.multitheftauto.com/wiki/SetVehicleHandling https://wiki.multitheftauto.com/wiki/SetModelHandling For other damage can you can also cancel the event: https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage (add the health loss to the vehicle it's health, to get the original health) And change HP: https://wiki.multitheftauto.com/wiki/SetElementHealth
  20. IIYAMA

    Help!!

    Stop screaming, you are not a baby. local achievementState = {} local achievement = "test" if not achievementState[achievement] then achievementState[achievement] = true end
  21. The shader reference isn't saved in to the variable `shader`. So create a shader and save it in to the shader variable before using it. https://wiki.multitheftauto.com/wiki/Element/Shader https://wiki.multitheftauto.com/wiki/DxCreateShader
  22. IIYAMA

    Help!!

    local index = 1 repeat print(index) index = index + 1 until index > 100
  23. It is the same for you. Don't post and reply here in the scripting section with code requests. Your post and replies are unwanted according to the section rules. Before posting in this section, please read the rules and have a nice day or two.
  24. IIYAMA

    Please help

    If you say so, then ok here you are: local players = getElementsByType ("player", root, true) for i=1, #players do local player = players[i] -- do your thing end
  25. IIYAMA

    Please help

    Learn first what a element, table and a loop is. After that I will provide you with examples, because else you will not understand the code. https://wiki.multitheftauto.com/wiki/Element https://www.lua.org/pil/2.5.html https://www.lua.org/pil/4.3.5.html
×
×
  • Create New...