[Ajuda] Ajuda comando /daradmin
#1

Tipo eu queria saber como faz , se a pessoa errar o ID de alguem aparece aquela mensagem

/daradmin [id] [nivel]

eu sei que й alguma coisa relacionada com cmdtext mas nгo sei o que usar...
Reply
#2

Exemplo:
pawn Код:
if(strcmp(cmd, "/padmin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok ( cmdtext, idx ) ;
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "* USE: /padmin [id] [Nivel]");
                return 1;
            }
            if(PlayerInfo[playerid][pAdmin] >= 4000)
            {
                if(admtrampando[playerid] == 0)
                {
                    new para1;
                    new level;
                    para1 = ReturnUser(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "* USE: /padmin [id] [Nivel]");
                        return 1;
                    }
                    if(PlayerInfo[para1][pAdmin] == 5000)
                    {
                        SendClientMessage(playerid, Cinza, "Vocк nгo pode promover um Admin Dono!");
                        return 1;
                    }
                    level = strval(tmp);
                    new AdminNome [MAX_PLAYERS];
                    new Player [MAX_PLAYERS];
                    GetPlayerName(playerid, AdminNome, sizeof(AdminNome)); // aki ele vai pegar o nome do admin
                    GetPlayerName(para1, Player, sizeof(Player));// aki ele vai pegar o nome do player a ser setado adm
                    INI_Open(ObterADM(playerid));
                    switch(level)
                    {
                        case 0:
                        {
                            INI_WriteInt("Admin", 0);
                            new Admin[100];
                            new perdeu[100];
                            format(perdeu, sizeof(perdeu), "O Admin %s retirou seu admin.", AdminNome);
                            SendClientMessage(para1, COLOR_LIGHTBLUE, perdeu);
                            format(Admin, sizeof(Admin), "Vocк retirou o Admin do jogador %s.", Player);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, Admin);
                            INI_Save();
                            INI_Close();
                            PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
                            return 1;
                        }
                        case 1:
                        {
                            INI_WriteInt("Admin", 1);
                        }
                        case 2:
                        {
                            INI_WriteInt("Admin", 2);
                        }
                        case 3:
                        {
                            INI_WriteInt("Admin", 3);
                        }
                        case 4:
                        {
                            INI_WriteInt("Admin", 4);
                        }
                        case 3000:
                        {
                            INI_WriteInt("Admin", 3000);
                        }
                        default: //nгo se usa case default: й default:
                        {
                            SendClientMessage(playerid, Cinza, "Erro: escolha o level de admin 0, 1, 2, 3, 4 ou 3000");
                            return 1;
                        }
                    }
                    PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
                    INI_Save();
                    INI_Close();
                    new MensagemPlayer [MAX_PLAYERS];
                    new MensagemAdmin [MAX_PLAYERS];
                    format(MensagemPlayer, sizeof(MensagemPlayer), "* Vocк foi promovido para Admin level %d - Por: %s.", level, AdminNome);//aqui vai formata mensagem para enviar ao player
                    format(MensagemAdmin, sizeof(MensagemAdmin), "* Vocк promoveu o jogador %s para Admin level %d.", Player, level);//aqui vai formata mensagem para enviar ao admin
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, MensagemAdmin) && SendClientMessage(para1, COLOR_LIGHTBLUE, MensagemPlayer);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, Cinza, "Vocк nгo estб trabalhando! (/trabalhar)");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, Cinza, "Vocк nгo й um administrador ou nгo tem level de Admin suficiente");
                return 1;
            }
        }
        return 1;
    }
eu fiz com switch.
Obs: й sу um exemplo!
Reply
#3

Cara mas isso nгo responde nada da minha pergunta .-.
Reply
#4

¬¬!
Como nгo ajudou em nada?
Basta olhar como estб ali que vocк tem a noзгo do que estб acontecendo!
Linhas
pawn Код:
new para1;            //Variavel que sera usada para indicar o player que recebe
                    new level;
                    para1 = ReturnUser(tmp); // ele pode ser tanto um ID ou a parte do nome
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp)) //se ele nгo escrever atй o /padmin [id] ele retorna mandando a mensagem
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "* USE: /padmin [id] [Nivel]");
                        return 1;
                    }
Reply
#5

o level e o para1 nгo estгo sendo usados.

Eu defini tudo ai quando eu digito o comando nada acontece e.e

olha ele ta assim ,nem erro da. mas quando eu digito o /daradmin acontece nada

pawn Код:
if (strcmp("/daradmin", cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] < 6)
        {
            SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo tem autorizaзгo para usar esse comando.");
            return 1;
        }
        tmp = strtok(cmdtext, playerid);
        if(!strlen(tmp))
        {
        SendClientMessage(playerid, COLOR_GRAD1, "USE: /daradmin [id] [Nivel]");
        return 1;
        }
        new para1;
        new level;
        para1 = ReturnUser(tmp);
        level = strval(tmp);
        if(strval(cmdtext) < 1 || strval(cmdtext) > 6)
        {
            SendClientMessage(playerid, COLOR_GRAD1, " O Nнvel do Admin deve ser entre 1 e 6 !");
            return 1;
        }
        format(string, sizeof(string), "   Vocк foi promovido para level  %d de Admin - Por %s", level, sendername);
        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "   Vocк promoveu o(a) %s Para o level %d de Admin.", giveplayer,level);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        getdate(year, month, day);
        gettime(hour,minute,second);
        format(string, sizeof(string), "%s deu admin nivel %d para %s [%d/%d/%d] бs [%d:%d:%d].", sendername, level, giveplayer, day,
        month, year, hour, minute, second);
        PAdminsLog(string);

    }
Reply
#6

Sim nй man vocк tem que continuar usando oque esta no code que te passei.
Reply
#7

E Esse "ObterADM" eu defino o que?
Reply
#8

Quote:
Originally Posted by LordShadow
Посмотреть сообщение
E Esse "ObterADM" eu defino o que?
pawn Код:
stock ObterADM(playerid)
{
    new conta[100];
    format(conta,100,"Admins/%s.ini",gPlayerName[playerid]);
    return conta;
}
Mano isso й sу um exemplo!

Tem muito mais coisas que precisa ser feito!
Reply
#9

Coloquei o comando inteiro. continua dando a mema coisa '-'
Reply
#10

Quote:
Originally Posted by ViniKuliveguisky
Посмотреть сообщение
pawn Код:
stock ObterADM(playerid)
{
    new conta[100];
    format(conta,100,"Admins/%s.ini",gPlayerName[playerid]);
    return conta;
}
Mano isso й sу um exemplo!

Tem muito mais coisas que precisa ser feito!
Й um exemplo!
Alias o seu GM pode ter funзхes(PlayerInfo[playerid][pAdmin]) bem diferentes das minhas!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)