09.03.2012, 00:06
pawn Код:
CMD:setadmin(playerid, params[])
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
if(IsPlayerAdmin(playerid))
{
new plid, leveladm;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "(INFO) Digite: /setadmin [id] [Level]");
return 1;
}
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, Vermelho, "(INFO) Digite: /setadmin [id] [Level]");
return 1;
}
leveladm = strval(tmp);
if(leveladm>=4)
{
SendClientMessage(playerid, Vermelho, "(INFO) Niveis permitidos: 0 a 3.");
return 1;
}
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
if(IsPlayerConnected(plid)) {
if(leveladm>=1) {
InfoPlayer[plid][pAdmin] = leveladm;
dini_IntSet(file, "LevelAdm",leveladm);
format(string, sizeof(string), "(INFO) O Admin Rcon %s (%d) (») Promoveu: %s (%d) para administrador (») Level: %d", aname,playerid,pname,plid,leveladm);
SendClientMessageToAll(tcadm, string);
format(string, sizeof(string), "{00FF7F}(INFO) Vocк foi promovido a Admin Level %d por : %s!", leveladm,aname);
SendClientMessage(plid,-1, string);
SetPlayerSkin(plid,217);
if(leveladm>1) {
//-x
}
}
if(leveladm == 0)
{
InfoPlayer[plid][pAdmin] = 0;
dini_IntSet(file, "LevelAdm",0);
format(string, sizeof(string), "(INFO) O Admin Rcon %s (%d) (») Retirou admin do jogador: %s (ID: %d)", aname,playerid,pname,plid);
SendClientMessageToAll(tcadm, string);
format(string, sizeof(string), "{00FF7F}(INFO) %s , retirou seu admin!",aname);
SendClientMessage(plid,-1, string);
SetPlayerSkin(plid,0);
if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
}
return 1;
}
else {
SendClientMessage(playerid, Vermelho, "(INFO) Jogador nгo conectado.");
return 1;
}
}
}