29.06.2011, 22:31
pawn Код:
if(!strcmp(cmd, "/setadmin", true))
{
new Level;
new Sjim[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][Admin] < 5) return SendClientMessage(playerid, 0xFC4430AA, "¤ Vocк nгo й administrador logado na RCON !");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
playerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
Level = strval(tmp);
if(Level < 1 || Level > 5) return SendClientMessage(playerid, 0xFFFF00AA, "¤ Somente level de administrador entre 1 e 5!");
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFC4430AA, "¤ (ERRO) Jogador nгo conectado!");
if(playerid != INVALID_PLAYER_ID)
{
format(Sjim, sizeof(Sjim), "¤ Vocк deu б %s (ID:%d), level %d de administrador.", name, playerid, Level);
SendClientMessage(playerid, 0x00A400AA, Sjim);
format(Sjim, sizeof(Sjim), "¤ [PROMOVIDO] O Administrador %s lhe deu Level %d de Administrador!", name, Level);
SendClientMessage(playerid, 0x00FF00AA, Sjim);
GameTextForPlayer(playerid, "~p~PROMOVIDO!", 5000, 0);
PlayerInfo[giveplayerid][Admin] = Level;
format(file, sizeof(file), "Contas/%s.ini", name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "Level", Level);
}
else
{
dini_IntSet(file, "Level", Level);
PlayerInfo[giveplayerid][Admin] = Level;
}
return 1;
}
return 1;
}
}