SA-MP Forums Archive
[Ajuda] /soltar - 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] /soltar (/showthread.php?tid=363670)



/soltar - Goku™ - 28.07.2012

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;
    }



Re: /soltar - .FuneraL. - 28.07.2012

Seria algo como:

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



Re: /soltar - Goku™ - 28.07.2012

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



Re: /soltar - .FuneraL. - 28.07.2012

Abaixo do new aname


Re: /soltar - Goku™ - 28.07.2012

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?



Re: /soltar - humildadeforever - 28.07.2012

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);


Re: /soltar - .FuneraL. - 28.07.2012

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:


Re: /soltar - Goku™ - 28.07.2012

Deu ceto, obrigado!


Re: /soltar - humildadeforever - 28.07.2012

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