From c89dd6f101a64a6d9e3dd1eafdaa35752003e2f1 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 10 Nov 2006 00:16:33 +0000 Subject: [PATCH] imported new API for exposing plugin info --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40175 --- plugins/include/sourcemod.inc | 31 +++++++++++++++++++++---------- plugins/test.sma | 17 ++++++++--------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/plugins/include/sourcemod.inc b/plugins/include/sourcemod.inc index dcef839d..7791cd90 100644 --- a/plugins/include/sourcemod.inc +++ b/plugins/include/sourcemod.inc @@ -7,15 +7,26 @@ #endif #define _sourcemod_included -/** - * Note: A plugin can define the following public strings for external information: - * public String:PLUGIN_AUTHOR[] - Author - * public String:PLUGIN_NAME[] - Name/Title - * public String:PLUGIN_DESCRIPTION[] - Short Description - * public String:PLUGIN_VERSION[] - Version information - * public String:PLUGIN_URL[] - Website URL - */ +struct Plugin +{ + const String:name[], /* Plugin Name */ + const String:description[], /* Plugin Description */ + const String:author[], /* Plugin Author */ + const String:version[], /* Plugin Version */ + const String:url[], /* Plugin URL */ +} +/** + * Declare this as a struct in your plugin to expose its information. + * Example: + * + * public Plugin:myinfo = + * { + * name = "My Plugin", + * //etc + * }; + */ +public Plugin:myinfo; /** * Called when the plugin is fully initialized and all known external references are resolved, @@ -37,11 +48,11 @@ forward OnPluginInit(); forward bool:OnPluginLoad(Handle:myself, bool:late, String:error[], err_max); /** - * Called when the plugin is first mapped into memory. Use this to set dynamic natives. + * Called when the plugin is first mapped into memory. Use this to set dynamic natives ONLY. * * @noreturn */ -forward OnPluginCreated(); +forward OnPluginRequirements(); /** * Called when the plugin is about to be unloaded. diff --git a/plugins/test.sma b/plugins/test.sma index e0837709..afab0a4c 100644 --- a/plugins/test.sma +++ b/plugins/test.sma @@ -1,16 +1,15 @@ #include -/** - * I don't know if I like this yet.... - */ -public String:PLUGIN_NAME[] = "Testcrab" -public String:PLUGIN_AUTHOR[] = "BAILOPAN" -public String:PLUGIN_VERSION[] = "0.0.0.0" -public String:PLUGIN_URL[] = "http://www.sourcemod.net/" -public String:PUBLIC_DESCRIPTION[] = "A test, fool" +public Plugin:myinfo +{ + name = "Test Plugin", + author = "BAILOPAN", + description = "Tests Stuff", + version = "1.0.0.0", + url = "http://www.sourceomd.net/" +} public OnPluginInit() { /* just a test, mommy */ - return 5 }