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

Include - OnPluginStart


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-05-2015 , 15:06   Include - OnPluginStart
Reply With Quote #1

Ciao guys,

I'd like to know if there is any way, how to make include file call some function on plugin start.

I don't wanna make some Init() function which plugin has to call in OnPluginStart, I want my include to do that automaticaly.
My include creates global forward, so I need to register it at last in OnPluginStart (preferebly in AskPluginLoad2).

Last edited by KissLick; 03-05-2015 at 15:08.
KissLick is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 03-05-2015 , 17:03   Re: Include - OnPluginStart
Reply With Quote #2

#include is a preproccessor command to tell the compiler to include the following file, you can't dynamically include file in your code. You will have to create a Library Plugin and use the forward/natives that sourcemod offer you.

Plugin Library
EDIT: Fixed link

Last edited by Mathias.; 03-05-2015 at 19:09. Reason: Fixed link
Mathias. is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-05-2015 , 18:17   Re: Include - OnPluginStart
Reply With Quote #3

I dont need to dynamicaly include file.
I need a way, how to use OnPluginStart() in my include file which I include like
PHP Code:
#include <myfile> 
KissLick is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 03-05-2015 , 18:20   Re: Include - OnPluginStart
Reply With Quote #4

Quote:
Originally Posted by KissLick View Post
I dont need to dynamicaly include file.
I need a way, how to use OnPluginStart() in my include file which I include like
PHP Code:
#include <myfile> 
same was you do in a plugin
__________________
WildCard65 is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-05-2015 , 18:22   Re: Include - OnPluginStart
Reply With Quote #5

Quote:
Originally Posted by WildCard65 View Post
same was you do in a plugin
nope :-/
Code:
error 021: symbol already defined: "OnPluginStart"
KissLick is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 03-05-2015 , 19:07   Re: Include - OnPluginStart
Reply With Quote #6

OH you put OnPLuginStart into your include files.

Well that a bad idea, the answer you seek (to do it the correct way) is the one in the link I post to you earlier, in other plugin you don't have to init anything, simply follow the sourcemod API to achieve what you desire.

Last edited by Mathias.; 03-05-2015 at 19:07.
Mathias. is offline
ClassicGuzzi
Veteran Member
Join Date: Oct 2013
Location: Argentina
Old 03-05-2015 , 19:27   Re: Include - OnPluginStart
Reply With Quote #7

Just define the code that you want to run on a function (insde your include), and then call that function inside the OnPluginStart from the main file.
__________________
ClassicGuzzi is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 03-06-2015 , 06:18   Re: Include - OnPluginStart
Reply With Quote #8

Quote:
Originally Posted by ClassicGuzzi View Post
Just define the code that you want to run on a function (insde your include), and then call that function inside the OnPluginStart from the main file.
Yeah, I did it this way (hope I will not forget about that in the future when trying to get it work :-D ).

Quote:
Originally Posted by Black-Rabbit View Post
OH you put OnPLuginStart into your include files.

Well that a bad idea, the answer you seek (to do it the correct way) is the one in the link I post to you earlier, in other plugin you don't have to init anything, simply follow the sourcemod API to achieve what you desire.
I didn't want some "core" / "support" plugin like simple chat processor.
The mechanisms are small, so I just wanted an include file (with the least attention from plugin as possible).
KissLick 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 13:11.


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