Advertisement
DanGT

dCMD!

Feb 11th, 2015
755
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.08 KB | None | 0 0
  1. #if defined _dcmd_included
  2.     #endinput
  3. #endif 
  4. #define _dcmd_included
  5.  
  6. #define COMMAND:%1(%2)          \
  7.             forward dcmd_%1(%2); \
  8.             public dcmd_%1(%2)
  9.  
  10. #define CMD:%1(%2) \
  11.             COMMAND:%1(%2)
  12.  
  13. #define command(%1,%2,%3) \
  14.             COMMAND:%1(%2, %3)
  15.  
  16. #define cmd(%1,%2,%3) \
  17.             COMMAND:%1(%2, %3)
  18.  
  19. #if !defined isnull
  20.     #define isnull(%1) \
  21.                 ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
  22. #endif
  23.  
  24. static __c, __command[32] = "dcmd_";
  25.  
  26. forward OnPlayerCommandPerfomed(playerid, sucess);
  27.  
  28. public OnPlayerCommandText(playerid, cmdtext[])
  29. {
  30.     __command = "dcmd_",
  31.     __c = 0;
  32.  
  33.     while(cmdtext[++__c] > 0x20)
  34.     if(0x41 <= cmdtext[__c] <= 0x5A)
  35.         cmdtext[__c] = tolower(cmdtext[__c]);
  36.  
  37.     strcat(__command, cmdtext, __c+6);
  38.     strdel(__command, 4, 5);
  39.  
  40.     if(!cmdtext[__c])
  41.         return CallLocalFunction("OnPlayerCommandPerfomed", "ii", playerid, CallLocalFunction(__command, "is", playerid, "\1")), true;
  42.    
  43.     return CallLocalFunction("OnPlayerCommandPerfomed", "ii", playerid, CallLocalFunction(__command, "is", playerid, cmdtext[__c+1])), true;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement