Jump to content

[HELP] Remove breakable trees forever.


koragg

Recommended Posts

Posted

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)

 

G6HYac9.jpg

I love rock/metal/pop but don't mind any other music genre except чалга...that thing sux 
I also love cars

PS I'm friendly

Posted
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)


 

Posted

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.

 

 

  • Like 1

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
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 :)

G6HYac9.jpg

I love rock/metal/pop but don't mind any other music genre except чалга...that thing sux 
I also love cars

PS I'm friendly

Posted
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.

  • Like 1
Posted (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 by MadnessReloaded
  • Like 1
  • Sad 1

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

Noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

G6HYac9.jpg

I love rock/metal/pop but don't mind any other music genre except чалга...that thing sux 
I also love cars

PS I'm friendly

Posted
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 :P Thanks a lot both to you and to @H!J@CK!

G6HYac9.jpg

I love rock/metal/pop but don't mind any other music genre except чалга...that thing sux 
I also love cars

PS I'm friendly

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...