Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "SDK\amx\amx.h"
- #include "SDK\plugincommon.h"
- #include "SDK\Invoke.h"
- typedef void (*logprintf_t)(char* format, ...);
- logprintf_t logprintf;
- extern void *pAMXFunctions;
- using namespace std;
- int P_GiveWeapon ( int playerid, int gunid, int ammo );
- cell AMX_NATIVE_CALL P_GiveWeapon(AMX* amx, cell* params)
- {
- g_Invoke->callNative(&PAWN::GivePlayerWeapon, params[1], params[2], params[3]);
- return 1;
- }
- PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
- {
- return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES;
- }
- PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
- {
- g_Invoke = new Invoke;
- pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
- logprintf = (logprintf_t) ppData[PLUGIN_DATA_LOGPRINTF];
- logprintf(" * Test plugin was loaded.");
- return true;
- }
- PLUGIN_EXPORT void PLUGIN_CALL Unload()
- {
- logprintf(" * Test plugin was unloaded.");
- }
- AMX_NATIVE_INFO PluginNatives[] =
- {
- {"P_GiveWeapon", P_GiveWeapon},
- {0, 0}
- };
- PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
- {
- g_Invoke->amx_list.push_back(amx);
- return amx_Register(amx, PluginNatives, -1);
- }
- PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
- {
- for(list<AMX *>::iterator i = g_Invoke->amx_list.begin(); i != g_Invoke->amx_list.end(); ++i)
- {
- if(*i == amx)
- {
- g_Invoke->amx_list.erase(i);
- break;
- }
- }
- return AMX_ERR_NONE;
- }
Advertisement
Add Comment
Please, Sign In to add comment