Advertisement
DraKiNs

[COD] echo c++ Plugin SAMP

Jun 26th, 2011
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.46 KB | None | 0 0
  1. //----------------------------------------------------------
  2. //
  3. //   SA:MP Multiplayer Modification For GTA:SA
  4. //   Copyright 2004-2007 SA:MP Team
  5. //
  6. //----------------------------------------------------------
  7.  
  8.  
  9. #include <iostream>
  10. #include <direct.h>  
  11.  
  12. #include "../SDK/amx/amx.h"
  13. #include "../SDK/plugincommon.h"
  14.  
  15. typedef void (*logprintf_t)(char* format, ...);
  16.  
  17. logprintf_t logprintf;
  18. void **ppPluginData;
  19. extern void *pAMXFunctions;
  20.  
  21.  
  22.  
  23. PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
  24. {
  25.     return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES;
  26. }
  27.  
  28. PLUGIN_EXPORT bool PLUGIN_CALL Load( void **ppData )
  29. {
  30.     pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
  31.     logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF];
  32.  
  33.     logprintf( "echo - By DraKiNs" );
  34.     return true;
  35. }
  36.  
  37.  
  38.  
  39. PLUGIN_EXPORT void PLUGIN_CALL Unload( )
  40. {
  41.     logprintf( "echo - By DraKiNs" );
  42. }
  43.  
  44. static cell AMX_NATIVE_CALL nativeEcho(AMX *amx, cell *params)
  45. {
  46.     if(params[0] / sizeof cell == 1)
  47.     {
  48.         logprintf("LennonGay Error: Invalid parameter count!");  
  49.         return false;
  50.     }      
  51.     char * str = "\0";
  52.     amx_StrParam(amx, params[1],str);
  53.     return printf(str);
  54. }
  55.  
  56.  
  57. AMX_NATIVE_INFO LennonGayNatives[ ] =
  58. {
  59.     { "echo",       nativeEcho},
  60.     { 0,                    0 }
  61. };
  62.  
  63.  
  64. PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
  65. {      
  66.  
  67.     return amx_Register( amx, LennonGayNatives, -1 );
  68. }
  69.  
  70. PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
  71. {
  72.     return AMX_ERR_NONE;
  73. }
  74. //By DraKiNs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement