Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. /*******************************************************************************
  2. * *
  3. * LifeCMD Powered by © Fusion Technology *
  4. * © All rights reserved *
  5. * Copyrights © Kazon 2012 *
  6. * LifeCMD Created: 1/01/13. *
  7. * *
  8. *******************************************************************************/
  9. /*==================================[Defines]==================================*/
  10. #define CMD:%1(%2) LCMD:%1(%2)
  11. #define COMMAND:%1(%2) LCMD:%1(%2)
  12.  
  13. #define LCMD:%1(%2) \
  14. forward lcmd_%1(%2); \
  15. public lcmd_%1(%2)
  16.  
  17. static bool:Call = false, bool:Finish = false;
  18. /*==================================[Public's]==================================*/
  19. public OnGameModeInit()
  20. {
  21. Call = funcidx("OnPlayerCommandCall") != -1;
  22. Finish = funcidx("OnPlayerCommandFinish") != -1;
  23. return CallLocalFunction("LifeCMD_OnGameModeInit", "");
  24. }
  25.  
  26. public OnPlayerCommandText(playerid, cmdtext[])
  27. {
  28. new cout, func[32];
  29. if(Call) CallRemoteFunction("OnPlayerCommandCall", "is", playerid, cmdtext);
  30. while(cmdtext[++cout] > ' ') func[cout-1] = tolower(cmdtext[cout]);
  31. while(cmdtext[cout] == ' ') cout++;
  32. format(func, 32, "lcmd_%s", func);
  33. if(!cmdtext[cout])
  34. {
  35. if(Finish) return CallRemoteFunction("OnPlayerCommandFinish", "isi", playerid, cmdtext, CallLocalFunction(func, "is", playerid, "\1"));
  36. return CallLocalFunction(func, "is", playerid, "\1");
  37. }
  38. if(Finish) return CallRemoteFunction("OnPlayerCommandFinish", "isi", playerid, cmdtext, CallLocalFunction(func, "is", playerid, cmdtext[cout]));
  39. return CallLocalFunction(func, "is", playerid, cmdtext[cout]);
  40. }
  41. /*==================================[Forward's]==================================*/
  42. forward OnPlayerCommandCall(playerid, cmdtext[]);
  43. forward OnPlayerCommandFinish(playerid, cmdtext[], success);
  44. forward LifeCMD_OnGameModeInit();
  45. forward LifeCMD_OnPlayerCommandText(playerid, cmdtext[]);
  46. /*==================================[Define's]==================================*/
  47. #if defined _ALS_OnPlayerCommandText
  48. #undef OnPlayerCommandText
  49. #else
  50. #define _ALS_OnPlayerCommandText
  51. #endif
  52. #define OnPlayerCommandText LifeCMD_OnPlayerCommandText
  53.  
  54. #if defined _ALS_OnGameModeInit
  55. #undef OnGameModeInit
  56. #else
  57. #define _ALS_OnGameModeInit
  58. #endif
  59. #define OnGameModeInit LifeCMD_OnGameModeInit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement