[Ajuda] /soltar
#1

Esse comando vem apresentando problemas, ele estб soltando atй pessoas que nгo estгo presas


pawn Код:
if(strcmp(cmd, "/soltar", true) == 0)
    {
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), P_CONTAS, aname);
        if(dini_Int(file, "pAdm01") == 1 || dini_Int(file, "Profissao") == Advogado || dini_Int(file, "Profissao") == Governador || dini_Int(file, "Profissao") == Prefeito || IsPlayerAdmin(playerid))
        {
            new tmp[256];
            new plid;
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Use: /soltar [id]");
                return 1;
            }
            plid = strval(tmp);
            if(gettime() - TempoComando[playerid] < 60)     return SendClientMessage(playerid, 0xFF0000FF, "Vocк tem que esperar 1 minuto para poder usar o comando novamente !");
            TempoComando[playerid] = gettime();
            if(plid == playerid)
            {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Vocк nгo pode fazer isto com si mesmo.");
            return 1 ;
            }
            if(!IsPlayerConnected(plid))
            {
                SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O jogador nгo estб online");
            }
            else
            {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(plid, pname, MAX_PLAYER_NAME);
                format(file2, sizeof(file2), P_CONTAS, pname);
                SendClientMessage(plid, Aviso, string);
                dini_IntSet(file2, "Preso", 0);
                preso[plid] = 0;
                SetPlayerHealth(plid,100);
                Preso[plid] = 0;
                algemado[plid] = 0;
                SpawnPlayer(plid);
                format(string, sizeof(string), "{0099FF}[x]{CCCCFF} O Advogado %s (%d) tirou o preso : %s (%d) da Prisгo", aname,playerid,pname,plid);
                SendClientMessageToAll(outraadm, string);
            }
        }
        else
        {
            SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Vocк nгo й um Advogado");
        }
        return 1;
    }
Reply
#2

Seria algo como:

pawn Код:
if(Preso[plid] == 0) return SendClientMessage(playerid, -1, "Este Jogador Nгo Estб Preso");
Isso no inicio no comando
Reply
#3

Mais eu coloco em baixo de que? (Desculpe-me sou novato em PAWN, tenho apenas 3 dias de pawn '-')
Reply
#4

Abaixo do new aname
Reply
#5

Deu um erro falou que o plid nгo estб definido, mais estб!
Ai eu mudei o [plid] por [playerid] e compilou certinho serб que vai dar conflitos?
Reply
#6

Quote:
Originally Posted by Goku™
Посмотреть сообщение
Deu um erro falou que o plid nгo estб definido, mais estб!
Ai eu mudei o [plid] por [playerid] e compilou certinho serб que vai dar conflitos?
Vai bugar o sistema, pois playerid й quem digita o comando, entгo vai dizer que ele nгo estб preso.
Use assim:
pawn Код:
if(strcmp(cmd, "/soltar", true) == 0)
    {
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), P_CONTAS, aname);
        if(dini_Int(file, "pAdm01") == 1 || dini_Int(file, "Profissao") == Advogado || dini_Int(file, "Profissao") == Governador || dini_Int(file, "Profissao") == Prefeito || IsPlayerAdmin(playerid))
        {
            new tmp[256];
            new plid;
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Use: /soltar [id]");
                return 1;
            }
            plid = strval(tmp);
            if(gettime() - TempoComando[playerid] < 60)     return SendClientMessage(playerid, 0xFF0000FF, "Vocк tem que esperar 1 minuto para poder usar o comando novamente !");
            TempoComando[playerid] = gettime();
            if(plid == playerid)
            {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Vocк nгo pode fazer isto com si mesmo.");
            return 1 ;
            }
            if(!IsPlayerConnected(plid))
            {
                SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O jogador nгo estб online");
            }
            if(Preso[plid] < 1) return SendClientMessage(playerid,-1,"Esse jogador nгo estб preso.");
            else
            {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(plid, pname, MAX_PLAYER_NAME);
                format(file2, sizeof(file2), P_CONTAS, pname);
                SendClientMessage(plid, Aviso, string);
                dini_IntSet(file2, "Preso", 0);
                preso[plid] = 0;
                SetPlayerHealth(plid,100);
                Preso[plid] = 0;
                algemado[plid] = 0;
                SpawnPlayer(plid);
                format(string, sizeof(string), "{0099FF}[x]{CCCCFF} O Advogado %s (%d) tirou o preso : %s (%d) da Prisгo", aname,playerid,pname,plid);
                SendClientMessageToAll(outraadm, string);
            }
        }
        else
        {
            SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Vocк nгo й um Advogado");
        }
        return 1;
    }
@.Funeral.

Debaixo do new aname? Veja aн onde que estб o new plid ou plid = strval(tmp);
Reply
#7

Quote:
Originally Posted by humildadeforever
Посмотреть сообщение
Vai bugar o sistema, pois playerid й quem digita o comando, entгo vai dizer que ele nгo estб preso.
Use assim:
pawn Код:
if(strcmp(cmd, "/soltar", true) == 0)
    {
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), P_CONTAS, aname);
        if(dini_Int(file, "pAdm01") == 1 || dini_Int(file, "Profissao") == Advogado || dini_Int(file, "Profissao") == Governador || dini_Int(file, "Profissao") == Prefeito || IsPlayerAdmin(playerid))
        {
            new tmp[256];
            new plid;
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Use: /soltar [id]");
                return 1;
            }
            plid = strval(tmp);
            if(gettime() - TempoComando[playerid] < 60)     return SendClientMessage(playerid, 0xFF0000FF, "Vocк tem que esperar 1 minuto para poder usar o comando novamente !");
            TempoComando[playerid] = gettime();
            if(plid == playerid)
            {
            SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Vocк nгo pode fazer isto com si mesmo.");
            return 1 ;
            }
            if(!IsPlayerConnected(plid))
            {
                SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O jogador nгo estб online");
            }
            if(Preso[plid] < 1) return SendClientMessage(playerid,-1,"Esse jogador nгo estб preso.");
            else
            {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(plid, pname, MAX_PLAYER_NAME);
                format(file2, sizeof(file2), P_CONTAS, pname);
                SendClientMessage(plid, Aviso, string);
                dini_IntSet(file2, "Preso", 0);
                preso[plid] = 0;
                SetPlayerHealth(plid,100);
                Preso[plid] = 0;
                algemado[plid] = 0;
                SpawnPlayer(plid);
                format(string, sizeof(string), "{0099FF}[x]{CCCCFF} O Advogado %s (%d) tirou o preso : %s (%d) da Prisгo", aname,playerid,pname,plid);
                SendClientMessageToAll(outraadm, string);
            }
        }
        else
        {
            SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Vocк nгo й um Advogado");
        }
        return 1;
    }
@.Funeral.

Debaixo do new aname? Veja aн onde que estб o new plid ou plid = strval(tmp);
Verdade Aninha , nгo utilizo strcmp a tempos :P, costumo por no inicio do comando D:
Reply
#8

Deu ceto, obrigado!
Reply
#9

Quote:
Originally Posted by .FuneraL.
Посмотреть сообщение
Verdade Aninha , nгo utilizo strcmp a tempos :P, costumo por no inicio do comando D:
Hehe, ali onde vocк disse ainda nem tinha dado o espaзo no comando :S (tmp = strtok(cmdtext, idx)

@Goku: De nada
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)