Raised This Month: $32 Target: $400
 8% 

Is ti possible to include .sp files?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blackdevil72
Member
Join Date: Jun 2010
Location: Bordeaux (France)
Old 04-24-2019 , 11:23   Is ti possible to include .sp files?
Reply With Quote #1

Hello!

First I've searched for that quite a lot and don't seem to have found any answer not in the sourcepawn/sourcemod doc nor on this forum. So if the answer is somewhere out there I'm sorry just please point me to the right direction. Thank a lot.

Cominf fom other language I've taken some habit.

For more easy reading and maintainance of my code I want to include various .sp in my main plugin file. Is that possible and how?

I tried to do:

PHP Code:
#include <sourcemod>
#include <myplugin_folder/myplugin_func.sp>
#include <myplugin_folder/myplugin_func2.sp> 
But when I try to compile I always end up with a "fatal error 183 can't read file".

Thank you again for your help.
__________________

blackdevil72 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-24-2019 , 11:27   Re: Is ti possible to include .sp files?
Reply With Quote #2

I think the file should go into scripting rather than scripting/include when including an .sp file but I am not sure in general as I prefer a large plugin.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 04-24-2019 , 11:39   Re: Is ti possible to include .sp files?
Reply With Quote #3

try #include "myplugin_folder/myplugin_func.sp"
instead of #include <myplugin_folder/myplugin_func.sp>
farawayf is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-24-2019 , 15:38   Re: Is ti possible to include .sp files?
Reply With Quote #4

Quote:
Originally Posted by farawayf View Post
try #include "myplugin_folder/myplugin_func.sp"
instead of #include <myplugin_folder/myplugin_func.sp>
I second this.

I like to break large plugins into multiple files based on a separation of concerns.

While it's not exactly well maintained anymore, the NativeVotes plugin is split into 3 files:
  • main plugin, which houses the main API declarations and general housekeeping
  • data storage functions which back the NativeVote methodmap
  • functions that vary based on the game engine in use

The data storage stuff was originally separate so that I could change out the implementation in a way that would be transparent to plugins that use the NativeVote API.

The third file probably should have been split into multiple different plugins instead and if I ever rewrite said plugin it probably will be, which would also allow it to support non-Valve games too.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 04-24-2019 at 15:39.
Powerlord is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 04-25-2019 , 12:57   Re: Is ti possible to include .sp files?
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
I second this.

I like to break large plugins into multiple files based on a separation of concerns.

While it's not exactly well maintained anymore, the NativeVotes plugin is split into 3 files:
  • main plugin, which houses the main API declarations and general housekeeping
  • data storage functions which back the NativeVote methodmap
  • functions that vary based on the game engine in use

The data storage stuff was originally separate so that I could change out the implementation in a way that would be transparent to plugins that use the NativeVote API.

The third file probably should have been split into multiple different plugins instead and if I ever rewrite said plugin it probably will be, which would also allow it to support non-Valve games too.
I second this as well, makes organization so much easier.

Last edited by ThatKidWhoGames; 04-25-2019 at 12:58.
ThatKidWhoGames is offline
blackdevil72
Member
Join Date: Jun 2010
Location: Bordeaux (France)
Old 04-25-2019 , 20:43   Re: Is ti possible to include .sp files?
Reply With Quote #6

Thank you every one that is what I was searching for. For the sake of any one searching this in the future here is a short resume of this:

PHP Code:
#include <something> 
Will search .inc files in the "include" folder

PHP Code:
#include <something.sp> 
wilt search .sp files in the "include" folder

PHP Code:
#include "something.sp" 
will search .sp files in the same folder
__________________


Last edited by blackdevil72; 04-25-2019 at 21:19.
blackdevil72 is offline
sdz
Senior Member
Join Date: Feb 2012
Old 04-26-2019 , 21:57   Re: Is ti possible to include .sp files?
Reply With Quote #7

includes inside of angle brackets (<this>) should be used for compiler specific inclusion or something like that, this is a c and c++ thing
anything else like externals, go enclosed in quotations like "this.sp"

although im fairly sure it will also include .inc files if you do like #include <includefile>

Last edited by sdz; 04-26-2019 at 21:57.
sdz 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 16:34.


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