[ Ajuda ] Comando Bugado.
#1

Este comando:
fica dando toda hora: Jogador Offline!
pawn Код:
CMD:setadmin(playerid, params[])
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    if(IsPlayerAdmin(playerid))
    {
        new leveladm, plid;
        new string[128];
        if(sscanf(params, "ud", plid, leveladm)) return SendClientMessage(playerid, -1, "Uso correto: /setadmin [ID] [Level]");
        if(!IsPlayerConnected(plid)) return SendClientMessage(playerid, -1, "Jogador Offline!");
        if(leveladm >= 3) return SendClientMessage(playerid, -1, "O level mбximo й 3!");
        if(IsPlayerConnected(plid))
        {
            if(leveladm >= 1)
            {
                InfoPlayer[plid][pAdmin] = leveladm;
                //DOF2_SetInt(vfile, "LevelAdm",leveladm); // Dps vc ver se ta certo '-
                DOF2_SetInt(vfile, "LevelAdm",  InfoPlayer[playerid][pAdmin] = leveladm);
                format(string, sizeof(string), "(INFO) Vocк foi promovido a Admin Level %d por : %s!", leveladm,aname);
                SendClientMessage(plid,-1, string);
                if(leveladm > 1) return 1;
            }
            if(leveladm == 0)
            {
                InfoPlayer[plid][pAdmin] = 0;
                //DOF2_SetInt(vfile, "LevelAdm",0); // Dps vc ver se ta certo '-
                DOF2_SetInt(vfile, "LevelAdm", InfoPlayer[playerid][pAdmin] = 0);
                format(string, sizeof(string), "(x) %s , retirou seu admin!",aname);
                SendClientMessage(plid,-1, string);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "(INFO) Vocк nгo й um Administrador RCON.");
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:setadmin(playerid, params[])
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    if(IsPlayerAdmin(playerid))
    {
        new leveladm, plid;
        new string[128];
        if(sscanf(params, "ud", plid, leveladm)) return SendClientMessage(playerid, -1, "Uso correto: /setadmin [ID] [Level]");
        if(IsPlayerConnected(plid)) return SendClientMessage(playerid, -1, "Jogador Offline!");
        if(leveladm >= 3) return SendClientMessage(playerid, -1, "O level mбximo й 3!");
        if(IsPlayerConnected(plid))
        {
            if(leveladm >= 1)
            {
                InfoPlayer[plid][pAdmin] = leveladm;
                //DOF2_SetInt(vfile, "LevelAdm",leveladm); // Dps vc ver se ta certo '-
                DOF2_SetInt(vfile, "LevelAdm",  InfoPlayer[playerid][pAdmin] = leveladm);
                format(string, sizeof(string), "(INFO) Vocк foi promovido a Admin Level %d por : %s!", leveladm,aname);
                SendClientMessage(plid,-1, string);
                if(leveladm > 1) return 1;
            }
            if(leveladm == 0)
            {
                InfoPlayer[plid][pAdmin] = 0;
                //DOF2_SetInt(vfile, "LevelAdm",0); // Dps vc ver se ta certo '-
                DOF2_SetInt(vfile, "LevelAdm", InfoPlayer[playerid][pAdmin] = 0);
                format(string, sizeof(string), "(x) %s , retirou seu admin!",aname);
                SendClientMessage(plid,-1, string);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "(INFO) Vocк nгo й um Administrador RCON.");
    }
    return 1;
}
Tenta aqui '-'
Reply
#3

coloca as tags certas please. '-

@Edit
mesma coisa ._.
Reply
#4

pawn Код:
CMD:setadmin(playerid, params[])
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    if(IsPlayerAdmin(playerid))
    {
        new leveladm, plid;
        new string[128];
        if(sscanf(params, "ud", plid, leveladm)) return SendClientMessage(playerid, -1, "Uso correto: /setadmin [ID] [Level]");
        if(leveladm >= 3) return SendClientMessage(playerid, -1, "O level mбximo й 3!");
        if(leveladm >= 1)
        {
            InfoPlayer[plid][pAdmin] = leveladm;
            //DOF2_SetInt(vfile, "LevelAdm",leveladm); // Dps vc ver se ta certo '-
            DOF2_SetInt(vfile, "LevelAdm",  InfoPlayer[playerid][pAdmin] = leveladm);
            format(string, sizeof(string), "(INFO) Vocк foi promovido a Admin Level %d por : %s!", leveladm,aname);
            SendClientMessage(plid,-1, string);
            if(leveladm > 1) return 1;
        }
        if(leveladm == 0)
        {
            InfoPlayer[plid][pAdmin] = 0;
            //DOF2_SetInt(vfile, "LevelAdm",0); // Dps vc ver se ta certo '-
            DOF2_SetInt(vfile, "LevelAdm", InfoPlayer[playerid][pAdmin] = 0);
            format(string, sizeof(string), "(x) %s , retirou seu admin!",aname);
            SendClientMessage(plid,-1, string);
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "(INFO) Vocк nгo й um Administrador RCON.");
    }
    return 1;
}
Nгo й necessario isso! o sscanf jб verifica se o player esta online ou nгo!
Reply
#5

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;
        }
    }
}
Ajudei? +rep
Reply
#6

Quote:
Originally Posted by paulor
Посмотреть сообщение
Nгo й necessario isso! o sscanf jб verifica se o player esta online ou nгo!
Errado. o sscanf verifica se todos os parвmetros foram digitados da maneira correta, nгo verifica se o ID estб conectado
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)