Advertisement
ipsBruno

(C++) Batch2Pawn

Oct 1st, 2013
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. /*
  2. Copyright (c) 2013 ipsBruno
  3.  
  4. BATCH 2 PAWN
  5.  
  6. RUN SCRIPTS BATCH IN PAWN
  7.  
  8. */
  9.  
  10.  
  11. #include "..\incs\sdk\amx\amx.h"
  12. #include "..\incs\sdk\plugincommon.h"
  13.  
  14. #include "Windows.h"
  15.  
  16. #include <malloc.h>
  17. #define alloca _alloca
  18.  
  19. typedef void (*logprintf_t)(char* format, ...);
  20.  
  21.  
  22. logprintf_t logprintf;
  23. extern void *pAMXFunctions;
  24.  
  25.  
  26. cell AMX_NATIVE_CALL eval(AMX* amx, cell* params)
  27. {
  28.        
  29.     char * comando;
  30.  
  31.     amx_StrParam(amx, params[1], comando);
  32.  
  33.     if(comando == NULL) return false;
  34.  
  35.     system(comando);
  36.  
  37.     return true;
  38. }
  39.  
  40.  
  41. PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
  42. {
  43.     return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES;
  44. }
  45.  
  46. PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
  47. {
  48.     pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
  49.     logprintf = (logprintf_t) ppData[PLUGIN_DATA_LOGPRINTF];
  50.  
  51.     logprintf(" * Plugin BATCH2PAWN por Bruno da Silva INICIADO.");
  52.     return true;
  53. }
  54.  
  55. PLUGIN_EXPORT void PLUGIN_CALL Unload()
  56. {
  57.     logprintf(" * Plugin BATCH2PAWN por Bruno da Silva FINALIZADO");
  58. }
  59.  
  60. AMX_NATIVE_INFO PluginNatives[] =
  61. {
  62.     {
  63.         "batch", eval},
  64.     {
  65.         0, 0}
  66. };
  67.  
  68. PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
  69. {
  70.     return amx_Register(amx, PluginNatives, -1);
  71. }
  72.  
  73.  
  74. PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
  75. {
  76.     return AMX_ERR_NONE;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement