koragg Posted December 30, 2017 Share Posted December 30, 2017 Hey guys, I want to remove the breakable trees mainly found at Back'O'Beyond's forests. I tried this code but they don't get removed, but when I output their IDs in the loop they do show up in chatbox and there're no errors in debug. Any idea how to permanently remove those small and annoying random trees? Server-side: local trees = { [881] = true, [882] = true, [883] = true, [884] = true, [885] = true, [889] = true, [891] = true, } ------------------------------------------------------------------------------------------------------------------------- function onResourceStart() for key, value in pairs(trees) do removeWorldModel(key, 10000, 0, 0, 0, 0) removeWorldModel(key, 10000, 0, 0, 0, 13) end end addEventHandler("onResourceStart", resourceRoot, onResourceStart) Link to comment
ShayF2 Posted December 30, 2017 Share Posted December 30, 2017 34 minutes ago, koragg said: Hey guys, I want to remove the breakable trees mainly found at Back'O'Beyond's forests. I tried this code but they don't get removed, but when I output their IDs in the loop they do show up in chatbox and there're no errors in debug. Any idea how to permanently remove those small and annoying random trees? Server-side: local trees = { [881] = true, [882] = true, [883] = true, [884] = true, [885] = true, [889] = true, [891] = true, } ------------------------------------------------------------------------------------------------------------------------- function onResourceStart() for key, value in pairs(trees) do removeWorldModel(key, 10000, 0, 0, 0, 0) removeWorldModel(key, 10000, 0, 0, 0, 13) end end addEventHandler("onResourceStart", resourceRoot, onResourceStart) You can use this, this only works so long as the script is running. There's no way to permanently remove the trees, but what you could do is put this in a script and put the script in auto launch in the mta server config. local trees = {881,882,883,884,885,889,891} addEventHandler('onResourceStart',resourceRoot,function() for i=1,#trees do removeWorldModel(trees[i],10000,0,0,0,0) removeWorldModel(trees[i],10000,0,0,0,13) end end) Link to comment
DRW Posted December 30, 2017 Share Posted December 30, 2017 Seen no errors at first glance, but I tried the script in a local server anyway just to be sure and it works just fine. 1 Link to comment
koragg Posted December 30, 2017 Author Share Posted December 30, 2017 Just now, MadnessReloaded said: Seen no errors at first glance, but I tried the script in a local server anyway just to be sure and it works just fine. The trees are removed? How?!? I tried it at my server as well and they were still there. 2 minutes ago, ShayF said: You can use this, this only works so long as the script is running. There's no way to permanently remove the trees, but what you could do is put this in a script and put the script in auto launch in the mta server config. local trees = {881,882,883,884,885,889,891} addEventHandler('onResourceStart',resourceRoot,function() for i=1,#trees do removeWorldModel(trees[i],10000,0,0,0,0) removeWorldModel(trees[i],10000,0,0,0,13) end end) Isn't this the same as what I've done but just done in another 'for' loop way? And yes, by permanently I meant as long as the script is running Link to comment
ShayF2 Posted December 30, 2017 Share Posted December 30, 2017 1 minute ago, koragg said: The trees are removed? How?!? I tried it at my server as well and they were still there. Isn't this the same as what I've done but just done in another 'for' loop way? And yes, by permanently I meant as long as the script is running I've compacted your code for you, removing any unnecessary things. I always do this with code, so nothing to worry about. I hope it helps. 1 Link to comment
DRW Posted December 30, 2017 Share Posted December 30, 2017 (edited) 4 minutes ago, koragg said: The trees are removed? How?!? I tried it at my server as well and they were still there. Haven't tried with the trees, but with other objects. The code works, so it's probably MTA or models' fault. Edited December 30, 2017 by MadnessReloaded 1 1 Link to comment
koragg Posted December 30, 2017 Author Share Posted December 30, 2017 Noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo... Link to comment
quindo Posted December 30, 2017 Share Posted December 30, 2017 Maybe https://wiki.multitheftauto.com/wiki/SetWorldSpecialPropertyEnabled with "randomfoliage" parameter? Not sure if it's gonna do what you need. 1 1 Link to comment
koragg Posted December 30, 2017 Author Share Posted December 30, 2017 22 minutes ago, quindo said: Maybe https://wiki.multitheftauto.com/wiki/SetWorldSpecialPropertyEnabled with "randomfoliage" parameter? Not sure if it's gonna do what you need. Exactly what I was looking for, you replied together with a friend who has had such a script Thanks a lot both to you and to @H!J@CK! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now