Clear object from filterscript only
#1

As title says, I actually want to remove objects from filterscript only, I use this function but it removes all valid objects, I just want it to remove the objects from filterscript, Is there a way to manipulate the code to remove objects from filterscript only? I've bunch of filterscripts with objects. They load and unload after each round of map.

Code:
ClearObjects()
{
	for(new i; i<MAX_OBJECTS; i++)
	{
		if(IsValidObject(i)) DestroyObject(i);
	}
}
Reply
#2

Store the ids of the first and the last object and use those as start and end point of the loop, respectively.
Reply
#3

You should consider using streamer for objects anyway. You could then just:
pawn Code:
Streamer_DestroyAllItems(STREAMER_TYPE_OBJECT, 0);
and removes all objects from the current script.
Reply
#4

Quote:
Originally Posted by Vince
View Post
Store the ids of the first and the last object and use those as start and end point of the loop, respectively.
There are tons of filterscript with different object ids, I can't do that for everyone.

Quote:

You should consider using streamer for objects anyway. You could then just:
Code:
Streamer_DestroyAllItems(STREAMER_TYPE_OBJECT, 0);
and removes all objects from the current script.

Yes but currently I've all my filterscript objects by CreateObject function, so do I need to go through all the filterscripts and convert them to streamer dynamic object?
Reply
#5

Yes, you have to but it is simple. CTRL + H and replace CreateObject with CreateDynamicObject. The rest of the parameters have default values so you don't need to change anything else.
Reply
#6

Quote:
Originally Posted by Konstantinos
View Post
Yes, you have to but it is simple. CTRL + H and replace CreateObject with CreateDynamicObject. The rest of the parameters have default values so you don't need to change anything else.
Alright, ty

EDIT: https://*********/njMqE3BpXSw
Reply
#7

One more question, Is there any fast way to make those Dynamic objects set to a different virtual world rather then going through each line and adding it.
Reply
#8

You edited 97 maps? You've got lots of patience, my friend!

Using an editor that supports regex such as Notepad++ would do the job I guess. I have never used regular expressions before so I can't help you on that. I actually took a look and tried myself in an online regex tester but I'm unsure if what I did was correct.
pawn Code:
// Regular expression :
(\b(CreateDynamicObject\()\b[^\)]+)\);
pawn Code:
// Entry to test against :
CreateDynamicObject(1200, 3.0, 4.0, 5.0, 13.0, 14.0, 15.0);
pawn Code:
// Replace with :
$1, .worldid = 5);
where 5 is the virtual world ID you need to change in each map.
Reply
#9

Thanks, the current problem I'm facing with dynamic object is when I get spawned, I usually fall in water, is there a streamer function I can put on OnPlayerSpawn to maybe boost up the performance on spawning and load up the objects faster. I tried freezing the player but the lagger will still fall in water.
Reply
#10

https://github.com/samp-incognito/sa...eamer_UpdateEx

pawn Code:
Streamer_UpdateEx(...);
SetPlayerPos(...);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)