GetLoadedFilterscriptsCount
#1

I need a function which counts loaded filterscripts. Is there any way to check if filterscript loads/unloads successfully?

OnFilterScriptInit doesn't get called in gamemode.
GetConsoleVarAsString doesn't work as it should.
Also I don't want to do something like this:
Gamemode:
Код:
new gLoadedFilterscripsCount;

forward IncreaseLoadedFilterscriptCount();
public IncreaseLoadedFilterscriptCount()
	gLoadedFilterscripsCount += 1;

forward DecreaseLoadedFilterscriptCount();
public DecreaseLoadedFilterscriptCount()
	gLoadedFilterscripsCount -= 1;

forward GetLoadedFilterscriptsCount();
public GetLoadedFilterscriptsCount()
	return gLoadedFilterscripsCount;
Every filterscript:
Код:
public OnFilterScriptInit()
{
	CallRemoteFunction("IncreaseLoadedFilterscriptCount", "");
	return 1;
}

public OnFilterScriptExit()
{
	CallRemoteFunction("DecreaseLoadedFilterscriptCount", "");
	return 1;
}
Any other ideas? Thanks in advance.
Reply
#2

Without any additional code or plugin it won't be possible (since the console variable only holds the first FS), YSF however has a function which lets you get all loaded Filterscripts (and count them).
Reply
#3

Quote:
Originally Posted by NaS
Посмотреть сообщение
Without any additional code or plugin it won't be possible (since the console variable only holds the first FS), YSF however has a function which lets you get all loaded Filterscripts (and count them).
Do you have any experience with YSF? Is it stable?
Reply
#4

Quote:
Originally Posted by 2Col
Посмотреть сообщение
Do you have any experience with YSF? Is it stable?
From my experience yes, especially if you only use functions like the one I mentioned (or some other per-player functions). But be aware that it is a memory hacking Plugin, so it probably won't work with new SAMP Versions until it's getting updated.

I personally wouldn't use it only for one function as I'm sure you can achieve it another way, but that's up to you.

You could for example put the example code you have above into an include and include it in every FS. Not a nice solution, but you won't have any dependancies.
Reply
#5

Quote:
Originally Posted by NaS
Посмотреть сообщение
From my experience yes, especially if you only use functions like the one I mentioned (or some other per-player functions). But be aware that it is a memory hacking Plugin, so it probably won't work with new SAMP Versions until it's getting updated.

I personally wouldn't use it only for one function as I'm sure you can achieve it another way, but that's up to you.

You could for example put the example code you have above into an include and include it in every FS. Not a nice solution, but you won't have any dependancies.
I completely agree with you. I think I'll use YSF for now. Thanks for your help. Let me know if you have any other ideas.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)