Clear object from filterscript only -
Penguin1997 - 07.09.2016
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);
}
}
Re: Clear object from filterscript only -
Vince - 07.09.2016
Store the ids of the first and the last object and use those as start and end point of the loop, respectively.
Re: Clear object from filterscript only -
Konstantinos - 07.09.2016
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.
Re: Clear object from filterscript only -
Penguin1997 - 07.09.2016
Quote:
Originally Posted by Vince
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?
Re: Clear object from filterscript only -
Konstantinos - 07.09.2016
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.
Re: Clear object from filterscript only -
Penguin1997 - 07.09.2016
Quote:
Originally Posted by Konstantinos
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
Re: Clear object from filterscript only -
Penguin1997 - 08.09.2016
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.
Re: Clear object from filterscript only -
Konstantinos - 08.09.2016
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.
Re: Clear object from filterscript only -
Penguin1997 - 08.09.2016
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.
Re: Clear object from filterscript only -
Konstantinos - 08.09.2016
https://github.com/samp-incognito/sa...eamer_UpdateEx
pawn Code:
Streamer_UpdateEx(...);
SetPlayerPos(...);