<Configurations> <Configuration Name="Debug|Win32" |
#include "./SDK/amx/amx.h" #include "./SDK/plugincommon.h"
#include "SDK\\plugin.h"
void **ppPluginData;
Originally Posted by 0rb
Minor thing, you can replace
Code:
#include "./SDK/amx/amx.h" #include "./SDK/plugincommon.h" Code:
#include "SDK\\plugin.h" |
Originally Posted by JeNkStAX
Heres what i do to create a new plugin.
1) Open Microsoft Visual Studio (Or Microsoft Visual C++ if you have the Express edition). 2) When the program has loaded click File->New->Project. 3) Then when the New Project window appears select Win32 Console Application then click Ok. 4) When the Win32 Application Wizard appears click next. 5) Then under Application Type change it to DLL and under Additional Options select Empty Project then click Finish. 6) Then when the project has been created you should see the Solution Explorer (If you dont then select View->Solution Explorer). 7) In the Solution Explorer right click My Plugin (Or your project name) and select Properties. In the properties window select Configuration Properties->Linker->Input. 9) Now where it says Module definition file type main.def. 10) In the solution explorer right click My Plugin and click Add->New Item. 11) When the Add New Item window appears select Module-Definition File and enter main as a name for it. (If you cant see Module-Definition File then select C++ File and name it main.def) 12) Now you should see main.def under Souce Files in the Solution Explorer (If not then expand Source Files). 13) Double click MyPlugin(Or your project name).def and copy the following into it. Code:
EXPORTS Supports Load Unload AmxLoad AmxUnload 15) Now repeat step 12 but this time open main.cpp. 16) Now copy the following into main.cpp. Code:
#include "./SDK/plugin.h" typedef void (*logprintf_t)(char* format, ...); logprintf_t logprintf; void **ppPluginData; extern void *pAMXFunctions; PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() { return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES; } PLUGIN_EXPORT bool PLUGIN_CALL Load( void **ppData ) { pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS]; logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF]; logprintf( "My Plugin got loaded." ); return true; } PLUGIN_EXPORT void PLUGIN_CALL Unload( ) { logprintf( "My Plugin got unloaded." ); } AMX_NATIVE_INFO MyProjectNatives[ ] = { { 0, 0 } }; PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx ) { return amx_Register( amx, MyProjectNatives, -1 ); } PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx ) { return AMX_ERR_NONE; } 1 In the Solution Explorer right click MyPlugin(Or your project name) and select Add->New Filter and name the new filter SDK. 19) Now right click the SDK filter and select Add->Existing Item. 20) Now browse to your plugin folder then open the SDK folder you just copied into there and select amxplugin.cpp. 1 You should now be able to compile your project with no Errors/Warnings. Also if you need a project file for any other plugin just ask and ill make one and send it to you. |