pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 99999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/PartOfName] [level]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/PartOfName] [level]");
return 1;
}
level = strvalEx(tmp);
if(level > 99999 || level < 0) { SendClientMessage(playerid, COLOR_GREY, " Don't go below number 0, or above number 99999 (1/2/3/4/1337/99999) !"); return 1; }
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
strmid(giveplayer, PlayerRPName(para1), 0, MAX_PLAYER_NAME);
strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
if(level < 2) PlayerInfo[para1][pTag] = NTAG_PLAYER;
else PlayerInfo[para1][pTag] = NTAG_ADMIN;
if(level > 0)
{
new rand = random(9999);
PlayerInfo[para1][pSecKey] = rand;
gAdminAuthorized[para1] = 1;
}
if(level > PlayerInfo[para1][pAdmin])
{
format(string, sizeof(string), " You have been promoted to a level %d admin by %s, your security key is %d.", level, sendername, PlayerInfo[para1][pSecKey]);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else
{
format(string, sizeof(string), " You have been demoted to a level %d admin by %s, your security key is %d.", level, sendername, PlayerInfo[para1][pSecKey]);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have demoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
PlayerInfo[para1][pAdmin] = level;
if(level < 1)
{
PlayerInfo[para1][pAdmin] = 0;
PlayerInfo[para1][pSecKey] = 0;
gAdminAuthorized[para1] = 0;
}
}
}
}
}
That code is impossible to read, partially due to the weird style (e.g. you should consider using sscanf, ZCMD) and the fact it's in [code] and not [pawn], however, you could add this line somewhere (not sure if I've used the correct variable name):
It worked but it changes my security Key and i get message i got demoted to level 0 admin ........ect...and my security key......blabla
so they really can change my security key after demoting me but when ui talk on Admin chat it says Community Director so i'am not demoted