YashasSamaga

Untitled

Jan 31st, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. typdef struct FunctionInfo
  2. {
  3.     char *name;
  4.     FunctionTypes type;
  5.     [sometype] address;
  6. }FuctionInfo;
  7.  
  8. enum FunctionTypes
  9. {
  10.     FUNCTION_AMX, //some misc func which is executed using ExecuteAmxFunction
  11.     FUNCTION_PLUGIN, //function is in my code
  12.     FUNCTION_STD_LOGICAL, //equal_to, greater, less, etc.
  13. };
  14.  
  15. FunctionType functions[] =
  16. {
  17.     {"asdasdad", FUNCTION_AMX, 0x480}, //ExecuteAmx understands 0x480
  18.     {"equal_to", FUNCTION_STD_LOGICAL, equal_to<int>()},
  19.     {"bla", FUNCTION_PLUGIN, FunctionInMyCode}
  20. };
  21.  
  22. int ExecuteAmxFunction(int address, int params[], param_count)
  23. {
  24.     .....
  25. }
  26.  
  27. cell AMX_NATIVE_CALL algo_lts(AMX* amx, cell* params)
  28. {
  29.      //bla bla bla
  30.      switch(params[2])
  31.      {
  32.         case FUNCTION_AMX:
  33.                 while(start != end)
  34.                 {
  35.                     [bla bla bla]
  36.                     if(ExecuteAmxFunction(functions[params[3]].address, some_array, array_size)) return false;
  37.                 }
  38.                 return true;
  39.         case FUNCTION_STD_LOGICAL:
  40.             std_lib_func(bla, bla, bla, functions[params[3]].address);
  41.        
  42.       }
  43. }
Add Comment
Please, Sign In to add comment