SA-MP Forums Archive
Get number of loaded filterscripts - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Get number of loaded filterscripts (/showthread.php?tid=260583)



Get number of loaded filterscripts - Double-O-Seven - 09.06.2011

Hi^^

Is it possible to get the number of loaded filterscripts? I thought I could count it with GetServerVarAsString but this won't work because only the first filterscript shows up :/


Re: Get number of loaded filterscripts - Ash. - 09.06.2011

I guess you could count the ones that are loaded in-game. I'm not sure how you would do it otherwise.

I guess you could do something like this within a script:

pawn Код:
//Global Var
new TotalFS;

//Function
stock LoadFS(name[])
{
     new str[64];
     format(str, sizeof(str), "loadfs %s", name);
     SendRconCommand(str);
     TotalFS++;
}

//Usage: LoadFS(filterscript name); - FUNCTION

//Get total players - although you could just request the variable data, if you wanted something logical, use:

stock GetTotalFilterscripts() return TotalFS;

//Or use a macro?

#define GetTotalFilterscripts() TotalFS
I guess you could do that?


Re: Get number of loaded filterscripts - Double-O-Seven - 09.06.2011

Well, this would require changing any script. I need something which can count number of scripts anytime in one script without changing any other scripts.


Re: Get number of loaded filterscripts - Mike Garber - 09.06.2011

I don't think that is possible, although an idea is, but it doesn't fit your needs, to use ******'s callback hook to OnFilterScriptInit (If it works with FS'es?)


Re: Get number of loaded filterscripts - alpha500delta - 09.06.2011

Maybe this or this? I'm not sure