Try this im shure it will work fine..thats the best..replace that /setadmin with this new one
Код:
if(strcmp(cmd, "/setadmin", true) == 0
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /[s]et[a]dmin[l]evel [playerid/PartOfName] [level(1-1338)]");
return 1;
}
new para1;
new level;
new playerlevel;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
playerlevel = PlayerInfo[para1][pAdmin];
if(PlayerInfo[playerid][pAdmin] >= 1337 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
if(level == playerlevel)
{
SendClientMessage(playerid, COLOR_GREY, "** Player is already that level");
return 1;
}
if(level >= 7 && level <= 1336) return SendClientMessage(playerid, COLOR_GREY,"* Only levels 0-6 and 1337-1338 Are allowed!");
if(level < 0 || level > 1338) return SendClientMessage(playerid, COLOR_GREY,"* Only levels 0-6 and 1337-1338 Are allowed!");
if(level > 4 && PlayerInfo[playerid][pAdmin] == 1337) return SendClientMessage(playerid, COLOR_GREY, "You can only promote admins to lvl 4 or below");
if(playerlevel >= 5 && PlayerInfo[playerid][pAdmin] == 1337) return SendClientMessage(playerid, COLOR_GREY, "You can not demote Main Administrators or Above.");
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
new Float:X, Float:Y, Float:Z;
GetPlayerPos(para1, X,Y,Z);
format(string, sizeof(string),"[ADMIN]: %s has set %s (%d)'s Level to: [%d]", sendername, giveplayer, para1, level);
ABroadCast(COLOR_LIGHTRED, string, 5);
format(string, sizeof(string), "** %s Gave You Admin Level: %d",sendername, level);
SendClientMessage(para1, TEAM_GROVE_COLOR, string);
if(level > PlayerInfo[para1][pAdmin])
{
format(string, sizeof(string), "Congratulations to %s. He is now Level: %d Admin !!!!",giveplayer, level);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
PlayerPlaySound(para1, 1056, X, Y, Z);
GameTextForPlayer(para1, "~y~Promoted!",7500,3);
format(string, sizeof(string), "** You have promoted %s (%d) to level %d.", giveplayer, para1, level);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
PlayerInfo[para1][pAdmin] = level;
PlayerInfo[para1][pHelper] = 3;
if(playerlevel == 0 && level >= 1)
{
admins ++;
}
}
else
{
PlayerPlaySound(para1, 1055, X, Y, Z);
GameTextForPlayer(para1, "~r~Demoted!",7500,3);
format(string, sizeof(string), "** You have demoted %s (%d) to admin level %d.", giveplayer, para1, level);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
PlayerInfo[para1][pAdmin] = level;
if(level == 0)
{
PlayerInfo[para1][pHelper] = 1;
admins --;
}
}
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Gave to %s Admin Level: [%d].",d,m,y,h,mi,s,sendername,giveplayer,level);
AdminLog(string);
ChatLog(string);
LoginLog(string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
return 1;
}
}
return 1;
}