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