Raised This Month: $51 Target: $400
 12% 

Plugin natives in OnPluginStart


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 09-17-2013 , 20:35   Plugin natives in OnPluginStart
Reply With Quote #1

If plugin "One" has custom natives will I be guaranteed to call those natives in plugin "Two"s OnPluginStart forward?

To make this a guarantee, would I have to use RegPluginLibrary in plugin "One"?

My concern is the order in which plugins are loaded.
hlstriker is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 09-17-2013 , 20:44   Re: Plugin natives in OnPluginStart
Reply With Quote #2

I think you can either use OnAllPluginsLoaded or use a library + OnLibraryAdded. I think the library thing is safer thought.

I believe I however had trouble myself (like strange bug happening on random clients; i.e. https://forums.alliedmods.net/showth...=205468&page=3). You need to use Optional Requirements stuff to make sure no problem happen IIRC. See http://wiki.alliedmods.net/Optional_...d_Scripting%29 .

Special thanks to POPOPOPOPOPOPOPOPOPOOPOPOPOPPOPOPPOPOWWWWWWWW AAAAARLORD.
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work
RedSword is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 09-17-2013 , 21:11   Re: Plugin natives in OnPluginStart
Reply With Quote #3

Alright, thanks.

I really wish there was a way to determine if a plugin handle was still valid or if there were callbacks for when a plugin loads/unloads. I know there is GetPluginStatus but that won't work when the plugins handle changes. It seems like the only way to do callbacks from another plugin is to cache the plugins name (and even that won't always work if the plugins name changes). Am I missing something?
hlstriker is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-17-2013 , 21:23   Re: Plugin natives in OnPluginStart
Reply With Quote #4

Quote:
Originally Posted by hlstriker View Post
Alright, thanks.

I really wish there was a way to determine if a plugin handle was still valid or if there were callbacks for when a plugin loads/unloads. I know there is GetPluginStatus but that won't work when the plugins handle changes. It seems like the only way to do callbacks from another plugin is to cache the plugins name (and even that won't always work if the plugins name changes). Am I missing something?
Use RegPluginLibrary along with OnLibraryAdded / OnLibraryRemoved fowards (and LibraryExists in the OnAllPluginsLoaded callback to get the initial state), or use a private forward.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 09-17-2013 at 21:25.
Powerlord is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 09-17-2013 , 21:33   Re: Plugin natives in OnPluginStart
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
Use RegPluginLibrary along with OnLibraryAdded / OnLibraryRemoved fowards (and LibraryExists in the OnAllPluginsLoaded callback to get the initial state), or use a private forward.
The funny thing is I never thought to use AddToForward in the native function itself. I would always cache the plugin handle then when I was ready to send the forward I would call AddToForward. This sure clears things up, thanks.
hlstriker is offline
Reply



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 11:10.


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