Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define MAX_SIZE_COMMAND 25
- #define MAX_SIZE_PARAMS 103
- #define mCmd:%0(%1,%2) \
- forward cmd_%0(%1,%2); \
- public cmd_%0(%1,%2)
- #define QCMD:%1() \
- forward cm_%1(playerid,params[],bool:help); \
- public cm_%1(playerid,params[],bool:help)
- forward OnPlayerCommandTextMCMD(playerid,cmdtext[]);
- public OnPlayerCommandTextMCMD(playerid,cmdtext[])
- {
- new
- LastPos = 1,
- command[MAX_SIZE_COMMAND],
- params[MAX_SIZE_PARAMS],
- testCommand[MAX_SIZE_COMMAND+5],
- ch
- ;
- while((ch = cmdtext[LastPos]) && ch != EOS && ch != ' ')
- {
- LastPos++;
- }
- strmid(command,cmdtext,1,LastPos);
- format(testCommand,sizeof(testCommand),"cmd_%s",command);
- strmid(params,cmdtext,LastPos+1,128);
- if(!params[0]) format(params,sizeof(params)," ");
- if(CallLocalFunction(testCommand,"is",playerid,params))
- {
- return true;
- }
- else
- {
- return SendClientMessage(playerid,-1,"Chybný příkaz");
- }
- }
- public OnPlayerCommandText(playerid,cmdtext[])
- {
- return OnPlayerCommandTextMCMD(playerid,cmdtext);
- }
Advertisement
Add Comment
Please, Sign In to add comment