Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. Use: https://wiki.multitheftauto.com/wiki/SetPedCameraRotation
  2. You might be able to validate the function with: https://www.tutorialspoint.com/lua/lua_debugging.htm This doesn't stop the function from being overwritten, but you can stop the script operations if the info tells you that a lua function is called instead of a C function.(afaik default mta functions are considered as C functions, but not 100% sure) print(debug.getinfo(1)) Maybe getinfo does the job:
  3. I do not know if that happens in the current version of MTA. But afaik there were in the past versions that didn't sync that. For security(cheating effect, but not real cheating) / (always small) de-sync you shouldn't not do that clientside.
  4. I don't think that is possible by default. do local vehicles = getElementsByType("vehicle") for i=1, #vehicles do local vehicle = vehicles[i] setElementFrozen(vehicle, true) end end You can freeze the vehicles, but that also means you can't drive them any more. https://wiki.multitheftauto.com/wiki/SetElementFrozen Or you could make the vehicles more heavy, with: (recommend this one) https://wiki.multitheftauto.com/wiki/SetModelHandling Or you can remove the collision between the players and the vehicles: https://wiki.multitheftauto.com/wiki/SetElementCollidableWith
  5. @overlocus For example this. setElementPosition(vehicle, 0, 0, 10) -- position setElementRotation(vehicle, 90, 180, 0, "ZYX") -- orientation/rotation Just play with it, until you understand it. (best way of learning) Quick test code: (client / server) do local vehicles = getElementsByType("vehicle") for i=1, #vehicles do local vehicle = vehicles[i] setElementPosition(vehicle, 0, 0, 10) -- position setElementRotation(vehicle, 90, 180, 0, "ZYX") -- orientation/rotation end end Wiki: https://wiki.multitheftauto.com/wiki/SetElementPosition https://wiki.multitheftauto.com/wiki/SetElementRotation
  6. IIYAMA

    Play Sound

    It is , take it or leave it. But don't be so ungrateful.
  7. That's why you need two... since polygons can't be limited on the height.
  8. IIYAMA

    Play Sound

    There is a tutorial for learning server client communication:
  9. Html/css/js is not made to be private. But what you can do: If you want to protect the interaction, you will have to write it with some more back-end or wire the JavaScript with lua.
  10. Write with JavaScript? https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript Ofcourse you can't protect it 100%, but atleast you can keep your HTML files almost empty. Making it beginner proof. SASS is unrelated. (It is a kind of advanced css format that will be converted to css after being compiled)
  11. You can use a second colshape in combination with: https://wiki.multitheftauto.com/wiki/IsElementWithinColShape So group the colshapes, attach a single handler. And use the function to check if the player is in both.
  12. 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.
  13. @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.
  14. That doesn't happen for me. Are you editing the files or something like that? (Or doing this before the resource has started?)
  15. 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.
  16. 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.
  17. 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.
  18. <object name="resource.admin2"></object> * (just as what Overkill said) Or rename the resource folder `admin2` to the original name: `admin`.
  19. 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.
  20. 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.
  21. https://wiki.multitheftauto.com/wiki/OnClientVehicleCollision https://wiki.multitheftauto.com/wiki/SetGarageOpen
  22. See example on wiki: https://wiki.multitheftauto.com/wiki/SetLowLODElement
  23. 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.
  24. 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.
  25. 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)
×
×
  • Create New...