[Question] Checking if function exists? - 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)
+--- Thread: [Question] Checking if function exists? (
/showthread.php?tid=370393)
[Question] Checking if function exists? -
Maxips2 - 19.08.2012
How would you check if a function is already defined in the script?
Re: [Question] Checking if function exists? -
SuperViper - 19.08.2012
It would need to be a public function.
pawn Код:
if(funcidx("OnFilterScriptInit") > -1)
{
// exist
}
else
{
// doesn't exist
}
Re: [Question] Checking if function exists? -
Maxips2 - 19.08.2012
I know about that function, but would it apply for stocks?
Re: [Question] Checking if function exists? -
SuperViper - 19.08.2012
Just turn it into a public, no biggie.
Re: [Question] Checking if function exists? -
Maxips2 - 19.08.2012
That's the thing, I can't do that.
Here's the issue:
There is a stock in the YSI library which is defined as 'bernstein' (hashing algorithm).
I need to use that function for an include I am working on, however the YSI library is very common.
If I would add the function to the include, people who use the YSI library will get an error saying that the function is already defined.
However if I don't put it in, assuming people already have that function defined people who don't use the YSI library will get an error saying the function is not defined.
I could rename it, but I believe people wouldn't want the same function to be defined twice in their gamemode assuming they would use the include.
Any suggestions?
Re: [Question] Checking if function exists? -
Vince - 19.08.2012
?
Re: [Question] Checking if function exists? -
Maxips2 - 19.08.2012
I have tried to use that, however it does some weird things...