19.03.2011, 11:19
Try this:
pawn Код:
dcmd_setcmdlevel(playerid, params[]
{
if(PlayerInfo[playerid][Level] >= CheckLevel("setcmdlevel"))
{
new cmdname[30], str[128], lvl;
if(sscanf(params, "s[30]i", cmdname, lvl)) return SendClientMessage(playerid, red, "USAGE: / setcmdlevel [command] [level]");
if(CommandExist(cmdname))
{
for(new i;i<217;i++)
{
if(YHash(cmdname, false)==Cmds[i][Unique])
{
Cmds[i][Level]=lvl;
}
}
format(str,sizeof(str),"The required level from %s is set to %i",cmdname,lvl);
SendClientMessage(playerid,blue,str);
} else {
format(str,sizeof(str),"Command %s is not found",cmdname);
SendClientMessage(playerid,blue,str);
return 1;
}
} else return LevelError(playerid,"setcmdlevel");
return 1;
}