Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* XMCD Version 1.2 By MegaDreams
- It's allowed to change things but it's not allowed to redistribute.
- It's not recommended to make any changes without having the knownledge how this is working.
- */
- #include <a_samp>
- #if defined _X_CMD_included
- #endinput
- #endif
- #define _X_CMD_included
- #pragma library X_CMD
- #define XCMD:%1(%2) \
- forward XCMD_%1(%2); \
- public XCMD_%1(%2)
- #define MAX_CMD_LENGTH 16
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new needle,
- cmd[MAX_CMD_LENGTH];
- if(!CallLocalFunction("OnPlayerUseCommand", "is", playerid, cmdtext)) return 1;
- if(strfind(cmdtext, " ") == -1)
- {
- format(cmd, MAX_CMD_LENGTH, "XCMD_%s", cmdtext[1]);
- return CallLocalFunction("OnPlayerPerformedCommand", "isi", playerid, cmdtext, CallLocalFunction(cmd, "is", playerid, -1));
- }
- while(cmdtext[++needle]>' '){cmd[needle-1] = cmdtext[needle];}
- while(cmdtext[needle] == ' ')needle++;
- format(cmd, MAX_CMD_LENGTH, "XCMD_%s", cmd);
- return CallLocalFunction("OnPlayerPerformedCommand", "isi", playerid, cmdtext, CallLocalFunction(cmd, "is", playerid, cmdtext[needle]));
- }
- forward OnPlayerUseCommand(playerid, cmdtext[]);
- forward OnPlayerPerformedCommand(playerid, cmdtext[], success);
Advertisement
Add Comment
Please, Sign In to add comment