19.03.2011, 11:07
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))
{
SendClientMessage(playerid, red, "USAGE: /setcmdlevel [command] [level]");
return 1;
}
else 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);
return 1;
}
else
{
format(str,sizeof(str),"Command %s is not found",cmdname);
SendClientMessage(playerid,blue,str);
return 1;
}
} else LevelError(playerid,"setcmdlevel");
return 1;
}