Raised This Month: $ Target: $400
 0% 

Check if native exists?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-05-2009 , 23:15   Check if native exists?
Reply With Quote #1

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.
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-06-2009 , 00:43   Re: Check if native exists?
Reply With Quote #2

Have you tried with :

native_filter(const name[], index, trap)

when name is "ggn_get_level", and trap is 0 ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 02-06-2009 , 00:56   Re: Check if native exists?
Reply With Quote #3

Code:
#if defined ggn_get_level
level = ggn_get_level(id)
#else
level = -1
#endif
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-06-2009 , 03:24   Re: Check if native exists?
Reply With Quote #4

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.
fysiks is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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