Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp.inc>
- #include <ZCMD.inc>
- /******************************************************************************/
- /* If you want to stick to only using enums:
- Pros:
- No loop
- Cons:
- Split into two parts (enum and variable)
- */
- /******************************************************************************/
- #define CMDMinLevel[%0] gCMDMinLevel[E_CMD_%0]
- #define CMDSetMinLevel(%0,%1) gCMDMinLevel[E_CMD_%0] = %1
- //The only reason we need to use "E_CMD_" prefix for each of the command names
- //is because it will interfere with local variables named 'v' or 'kill', etc
- //Unfornately PAWN doesn't categorize enum constants
- enum E_CMD_PERMISSIONS {
- E_CMD_v,
- E_CMD_setlevel,
- E_CMD_kill
- };
- //Obviously you can modify these values from database because they are variables.
- //But you need to make sure index is correct
- new
- gCMDMinLevel[E_CMD_PERMISSIONS] = {
- 2,
- 5,
- 1
- }
- ;
- /******************************************************************************/
- /* Your regular scripts here */
- /******************************************************************************/
- enum e_pInfo {
- aLevel
- };
- new pInfo[MAX_PLAYERS][e_pInfo];
- main(){}
- public OnFilterScriptInit() {
- //Changing permissions
- CMDSetMinLevel(v, 5);
- return true;
- }
- CMD:v(playerid, params[]) {
- if(pInfo[playerid][aLevel] < CMDMinLevel[v])
- return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Insufficient permissions to use this command!");
- return true;
- }
Add Comment
Please, Sign In to add comment