[Pedido] Comando de setar ADM
#1

Alguem me ajuda ai com um comando de setar ADM,

eu quero um que seja
/daradmin [ID] [Nivel]

Ja tentei varios mais todos dao erros.

Alguem me ajuda PLZ
ja tenho as enums.

Minha Enum de Adm e pAmin
Reply
#2

pawn Код:
if(strcmp(cmd, "/daradmin", true) == 0)
    {
        if(Admin[playerid] >= 8 || IsPlayerAdmin(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Uso: /daradmin [ID] [LEVEL]");
            new id, lvl[256], level;
            id = ReturnUser(tmp);
            lvl = strtok(cmdtext, idx);
            level = strval(lvl);
            if(!strlen(lvl)) return SendClientMessage(playerid, -1, "Uso: /daradmin [ID] [LEVEL]");
            if(level > 10) return SendClientMessage(playerid, -1, "Level mбximo: 10.");
            if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "ID INVALIDO");
            Admin[id] = level;
            new string[256], n[24], n2[24];
            GetPlayerName(id, n, 24);
            GetPlayerName(playerid, n2, 24);
            format(string, 128, "Vocк deu admin level {00FF00}%d{FFFFFF} para o jogador {00FF00}%s{FFFFFF} .", level, n);
            SendClientMessage(playerid, -1, string);
            format(string, 128, "O administrador {FF4500}%s{FFFFFF} te deu admin nivel {FF4500}%d{FFFFFF} Parabйns.",n2, level);
            SendClientMessage(id, -1, string);
        }
        else { SendClientMessage(playerid, VERDE_AZUL, "Erro: {FFA500} Vocк nгo estб autorizado a usar este comando."); }
        return 1;
    }
erro? poste aqui talvez possa ajuda-lo
Reply
#3

9 Errors
Код:
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(512) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(512) : error 017: undefined symbol "idx"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(513) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(515) : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(516) : error 017: undefined symbol "idx"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(521) : error 017: undefined symbol "Admin"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(521) : warning 215: expression has no effect
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(521) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(521) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(521) : fatal error 107: too many error messages on one line
Reply
#4

Vocк jб tem uma variбvel relacionada ao level de admin do jogador?
Reply
#5

sim
Tenho a PlayerInfo[playerid][pAdmin]
e tenho uma stock que define cada lvl de adm
Код:
stock Admins(playerid)
{
    new PlayerAdmin[64];
    if(PlayerInfo[playerid][pAdmin] == 1) { PlayerAdmin = "Moderador Estagiario"; }
    else if(PlayerInfo[playerid][pAdmin] == 2) { PlayerAdmin = "Moderador"; }
    else if(PlayerInfo[playerid][pAdmin] == 3) { PlayerAdmin = "Administrador Estagiario"; }
    else if(PlayerInfo[playerid][pAdmin] == 4) { PlayerAdmin = "Administrador"; }
    else if(PlayerInfo[playerid][pAdmin] == 5) { PlayerAdmin = "Administrador Fundador"; }
    return PlayerAdmin;
}
Reply
#6

pawn Код:
new Admin[MAX_PLAYERS];
pawn Код:
if(strcmp(cmd, "/admins", true) == 0)
    {
        SendClientMessage(playerid, 0xFF00FFFF, "________| ADMINS ONLINE |________");
        new string[100], n[24];
        for(new i = 0; i < MAX_PLAYERS; i ++)
        {
        if(Admin[i] > 0)
        {
                GetPlayerName(i, n, sizeof(n));
                if(AFK[i] == 1) { format(string, sizeof(string), " » %s - Level: %d {FF0522}[AFK]", n, Admin[i]); }
                else
                {
                    if(Servico[i] == 1) { format(string, sizeof(string), " » %s - Level: %d {00FF15}[EM SERVIЗO]", n, Admin[i]); }
                    else { format(string, sizeof(string), " » %s - Level: %d {7FFF00}[JOGANDO]", n, Admin[i]); }
                }
                SendClientMessage(playerid, -1, string);
            }
        }
        return 1;
    }
eu uso por nivel ;l
Reply
#7

pawn Код:
if(strcmp(cmd, "/daradmin", true) == 0)
    {
        if (IsPlayerAdmin(playerid))
        {
            if(IsPlayerConnected(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "USO: /daradmin [playerid/Parte-do-Nick] [level(1-5000)]");
                    return 1;
                }
                new para1;
                new level;
                para1 = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                level = strval(tmp);
                if (PlayerInfo[playerid][pAdmin] >= 5 || IsPlayerAdmin(playerid))
                {
                    if(IsPlayerConnected(para1))
                    {
                        if(para1 != INVALID_PLAYER_ID)
                        {
                            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            PlayerInfo[para1][pAdmin] = level;
                            printf("|ADMIN|: %s promoveu %s para administrador no nivel %d.", sendername, giveplayer, level);
                            format(string, sizeof(string), "Vocк foi promovido a moderador, no nнvel %d pelo administrador %s.", level, sendername);
                            SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                            format(string, sizeof(string), "Vocк promoveu %s com nнvel %d.", giveplayer,level);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        }
                    }
                }
                    else
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "   Vocк nгo pode usar esse comando!");
                }
            }
            return 1;
        }
    }
tente isso para daradmin
@edit
tem que ser admin rcon ou level 5 maior pra dar admin...
Reply
#8

deram 12 Erros Izac
Код:
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(519) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(519) : error 017: undefined symbol "idx"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(520) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(522) : error 017: undefined symbol "COLOR_GRAD2"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(527) : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(528) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(528) : error 017: undefined symbol "idx"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(529) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(536) : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(536) : error 017: undefined symbol "giveplayer"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(536) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(536) : fatal error 107: too many error messages on one line
Reply
#9

pawn Код:
new giveplayer[MAX_PLAYER_NAME];

vc tem strtok no gm?

e o cmd

pawn Код:
if(strcmp(cmd, "/daradmin", true) == 0)
    {
        if (IsPlayerAdmin(playerid))
        {
            if(IsPlayerConnected(playerid))
             {
                new tmp[128];
                new idx;
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, 0x00FF00AA, "USO: /daradmin [playerid/Parte-do-Nick] [level(1-5000)]");
                    return 1;
                }
                new tmp[128];
                new para1;
                new level;
                para1 = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                level = strval(tmp);
                if (PlayerInfo[playerid][pAdmin] >= 5 || IsPlayerAdmin(playerid))
                {
                    if(IsPlayerConnected(para1))
                    {
                        if(para1 != INVALID_PLAYER_ID)
                        {
                            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            PlayerInfo[para1][pAdmin] = level;
                            printf("|ADMIN|: %s promoveu %s para administrador no nivel %d.", sendername, giveplayer, level);
                            format(string, sizeof(string), "Vocк foi promovido a moderador, no nнvel %d pelo administrador %s.", level, sendername);
                            SendClientMessage(para1, 0x008080AA, string);
                            format(string, sizeof(string), "Vocк promoveu %s com nнvel %d.", giveplayer,level);
                            SendClientMessage(playerid, 0x80FF00AA, string);
                        }
                    }
                }
                    else
                {
                    SendClientMessage(playerid, 0x0000FFAA, "   Vocк nгo pode usar esse comando!");
                }
            }
            return 1;
        }
    }
Reply
#10

tenho esse negoзo de strok nao ...

--
Isaac seu codigo ainda continua dando erros, agora deu so 8
Код:
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(528) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(534) : error 021: symbol already defined: "tmp"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(537) : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(538) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(547) : error 017: undefined symbol "sendername"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(547) : error 017: undefined symbol "sendername"
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(547) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Winxp\Meus documentos\GTA SAMP\meu\gamemodes\meu.pwn(547) : fatal error 107: too many error messages on one line
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)