AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check if native exists? (https://forums.alliedmods.net/showthread.php?t=85120)

fysiks 02-05-2009 23:15

Check if native exists?
 
I have written a plugin to compliment DOD gungame (v2.00B3.7). For convenience of my plugin I created a native in the gungame_base so I could retreive a value (ggn_get_level).

So, my question is: Is there a way to find out if my native exists so that if someone without my version of gungame_base and gungame.inc can still use it?

Effectively I want to do this:

PHP Code:

if(native_exists("ggn_get_level"))
 
level ggn_get_level(id)
else
 
level = -

I've looked at native filtering and it looks like it would only work to get the plugin to load. I need it to work like the cstrike example but with a specific native and not a module.

ConnorMcLeod 02-06-2009 00:43

Re: Check if native exists?
 
Have you tried with :

native_filter(const name[], index, trap)

when name is "ggn_get_level", and trap is 0 ?

Emp` 02-06-2009 00:56

Re: Check if native exists?
 
Code:

#if defined ggn_get_level
level = ggn_get_level(id)
#else
level = -1
#endif


fysiks 02-06-2009 03:24

Re: Check if native exists?
 
I think Emp's solution would be the easiest and would only require a local compile to execute successfully.

I think I will forego the compatibility I was seeking as my plugin will not be put on many servers (if more than one).

Thanks for the effort anyways.


All times are GMT -4. The time now is 01:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.