#define ocmd:%1(%2) forward ocmd_%1(%2);\
public ocmd_%1(%2)
public OnPlayerCommandText(playerid,cmdtext[])
{
cmdtext[0]='_';
new ocmdStr[128],ocmdParams[128],bool:ocmdAffe,ocmdFu;
for(new oi;oi<128;oi++)
{
if(cmdtext[oi]=='\0')break;
if((cmdtext[oi]==' ')&&(!ocmdAffe))
{
ocmdAffe = true;
continue;
}
if(!ocmdAffe)ocmdStr[oi] = tolower(cmdtext[oi]);
else
{
ocmdParams[ocmdFu]=cmdtext[oi];
ocmdFu++;
}
}
format(ocmdStr,128,"ocmd%s",ocmdStr);
if(!strlen(ocmdParams))format(ocmdParams,128," ");
if(CallLocalFunction(ocmdStr,"ds",playerid,ocmdParams))return 1;
cmdtext[0]='/';
return CallLocalFunction("ocmdOnPlayerCommandText","ds",playerid,cmdtext);
}
#define OnPlayerCommandText ocmdOnPlayerCommandText
forward ocmdOnPlayerCommandText(playerid,cmdtext[]);