/* bCMD - New Command Processer Creator: BlueX Version: 1.2 Last Update: 20/07/2012 */ #if defined _bcmd_include #endinput #endif #define _bcmd_include #include #define bCMD[%1]-(%2)\ forward bcmd_%1(%2);\ public bcmd_%1(%2) #define bcmd:%1(%2) \ bCMD[%1]-(%2) #if !defined isnull #define isnull(%1) \ ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1])))) #endif forward OnPlayerCallCommand(playerid,cmdtext[],sucess); forward bKey(playerid,_key[],cmdtext[]); const C_MAX_FUNC_NAME = 32; public bKey(playerid,_key[],cmdtext[]){ if(!strfind(cmdtext,_key,true)) OnPlayerCommandText(playerid,cmdtext); return 0; } public OnPlayerCommandText(playerid, cmdtext[]){ new _callback[C_MAX_FUNC_NAME],_cmd[C_MAX_FUNC_NAME]; for(new a; cmdtext[++a] > ' ';) _cmd[a-1] = tolower(cmdtext[a]); format(_callback,sizeof(_callback),"bcmd_%s",_cmd); for(new b; cmdtext[++b] > ' ';) strmid(cmdtext,cmdtext,b+2,32,32); return CallLocalFunction("OnPlayerCallCommand","dsd",playerid,_cmd,CallLocalFunction(_callback,"ds",0,isnull(cmdtext) ? ("\1") : (cmdtext))); } #if defined _ALS_OnPlayerCommandText #undef OnPlayerCommandText #else #define _ALS_OnPlayerCommandText #endif #define OnPlayerCommandText bcmd_OnPlayerCommandText forward bcmd_OnPlayerCommandText(playerid, cmdtext[]);