Kaczmi

Untitled

Mar 26th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define MAX_SIZE_COMMAND 25
  4. #define MAX_SIZE_PARAMS 103
  5.  
  6. #define mCmd:%0(%1,%2) \
  7. forward cmd_%0(%1,%2); \
  8. public cmd_%0(%1,%2)
  9.  
  10. #define QCMD:%1() \
  11. forward cm_%1(playerid,params[],bool:help); \
  12. public cm_%1(playerid,params[],bool:help)
  13.  
  14. forward OnPlayerCommandTextMCMD(playerid,cmdtext[]);
  15.  
  16.  
  17. public OnPlayerCommandTextMCMD(playerid,cmdtext[])
  18. {
  19. new
  20. LastPos = 1,
  21. command[MAX_SIZE_COMMAND],
  22. params[MAX_SIZE_PARAMS],
  23. testCommand[MAX_SIZE_COMMAND+5],
  24. ch
  25. ;
  26.  
  27. while((ch = cmdtext[LastPos]) && ch != EOS && ch != ' ')
  28. {
  29. LastPos++;
  30. }
  31. strmid(command,cmdtext,1,LastPos);
  32. format(testCommand,sizeof(testCommand),"cmd_%s",command);
  33. strmid(params,cmdtext,LastPos+1,128);
  34. if(!params[0]) format(params,sizeof(params)," ");
  35. if(CallLocalFunction(testCommand,"is",playerid,params))
  36. {
  37. return true;
  38. }
  39. else
  40. {
  41. return SendClientMessage(playerid,-1,"Chybný příkaz");
  42. }
  43. }
  44.  
  45. public OnPlayerCommandText(playerid,cmdtext[])
  46. {
  47. return OnPlayerCommandTextMCMD(playerid,cmdtext);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment