SA-MP Forums Archive
[Ajuda] comando de adm - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] comando de adm (/showthread.php?tid=389399)



comando de adm - Felipe_Wesker - 01.11.2012

Gostaria de ajuda para criar um comando, simples, de dar admin. Nгo precisa nem salvar, mas apenas setar o player para admin.

Algo mais ou menos assim:
pawn Код:
if(strcmp(cmd, "/daradmin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USO: /daradmin[playerid/Parte-do-Nick]");
                return 1;
            }
            GetPlayerName(playerid, nome, sizeof nome);
            if(PlayerInfo[playerid][pAdmin] >= 4999)
            {
                       
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Sem Autorizaзгo.");
            }
        }
        return 1;
    }
Nesse codigo ai nao tem a funзao pra escolher o id e nem de setar o id para
pawn Код:
[pAdmin] = 5000
Se alguem puder me ajudar com isso, vlw


Re: comando de adm - Victor' - 01.11.2012

pawn Код:
if(strcmp(cmd, "/daradmin", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        tmp = strtok(cmdtext, idx);
        static id, nivel;
       
        if(!strlen(tmp))
            return SendClientMessage(playerid, COLOR_GRAD2, "USO: /daradmin[playerid/Parte-do-Nick] [nivel]");
           
        id = strval(tmp);
           
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
            return SendClientMessage(playerid, COLOR_GRAD2, "USO: /daradmin[playerid/Parte-do-Nick] [nivel]");
       
        nivel = strval(tmp);
           
        GetPlayerName(playerid, nome, sizeof nome);
        if(PlayerInfo[playerid][pAdmin] >= 4999)
        {
            PlayerInfo[id][pAdmin] = nivel;
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "Sem Autorizaзгo.");
        }
    }
    return 1;
}



Re: comando de adm - Felipe_Wesker - 02.11.2012

da error em:

pawn Код:
GetPlayerName(playerid, nome, sizeof nome);
nгo reconhece o "nome"


Re: comando de adm - ForT - 02.11.2012

no comeзo do comando
pawn Код:
new nome[MAX_PLAYER_NAME];