[Ajuda] Comando
#1

bom eu nгo tenho ideia de como colocar a sscanf neste comando
pawn Код:
CMD:prender(playerid, params[])
{
    new idx;
    if(IsPlayerConnected(playerid))
    {
           new string[128];
        if(IsACop(playerid))
        {
           
            if(OnDuty[playerid] != 1)
            {
               
                SendClientMessage(playerid, COR_CINZA, "   Vocк nгo Bateu o cartгo!");
                return 1;
            }
            if(!PlayerToPoint(12.0, playerid, 268.3327,77.8972,1001.0391) && !PlayerToPoint(12.0, playerid, 1545.4073,-1607.9791,13.3828) && !PlayerToPoint(12.0, playerid, 324.3141,-1496.9177,24.9219) && !PlayerToPoint(12.0, playerid, 920.5212,-1184.8267,16.9766) &&  !PlayerToPoint(12.0, playerid, 221.1459,115.3492,999.0156) && !PlayerToPoint(12.0, playerid, 193.9101,179.2799,1003.0234) && !PlayerToPoint(12.0, playerid, 1545.7220,-1609.4769,13.3828)
            && !PlayerToPoint(12.0, playerid, 1019.6051,-317.6436,73.9922) && !PlayerToPoint(12.0, playerid, 195.5733,158.4008,1003.0234) && !PlayerToPoint(12.0, playerid, 1410.2281,413.0080,19.7578)
            && !PlayerToPoint(12.0, playerid, -1298.8188,490.5014,11.1953) && !PlayerToPoint(12.0, playerid, 264.1557,77.5797,1001.0391) && !PlayerToPoint(12.0, playerid, 1361,175.1075,1003.0234) && !PlayerToPoint(12.0, playerid, 321.8284,315.6733,999.1484) && !PlayerToPoint(12.0, playerid, 1807.5519,-1689.7974,13.5461) && !PlayerToPoint(12.0, playerid, 899.5557,-1206.2456,16.9766) && !PlayerToPoint(12.0, playerid, -509.7748,-557.3786,25.5234))
            {
                // Jail spot    622.9644,-592.8429,17.1165
                SendClientMessage(playerid, COR_CINZA, "   Vocк nгo estб perto da cela, nгo pode prender o suspeito !");
                return 1;
            }
            tmp = strtok(cmd, idx);
            if(!strlen(tmp))
            {
               
                SendClientMessage(playerid, COR_BRANCO, "USE: /prender [id] [tempo (minutos)] [fianca (0=nao 1=sim)] [preco da fianca]");
                return 1;
            }
            iddele = ReturnUser(tmp);
            tmp = strtok(cmd, idx);
            if(!strlen(tmp))
            {
               
                SendClientMessage(playerid, COR_BRANCO, "USE: /prender [id] [tempo (minutos)] [fianca (0=nao 1=sim)] [preco da fianca]");
                return 1;
            }
            new time = strval(tmp);
            if(time < 1 || time > 20) { SendClientMessage(playerid, COR_CINZA, "   O Tempo nгo pode ser menor que 1 nem maior que 20 !"); return 1; }
            tmp = strtok(cmd, idx);
            if(!strlen(tmp))
            {
               
                SendClientMessage(playerid, COR_BRANCO, "USE: /prender [id] [tempo (minutos)] [fianca (0=nao 1=sim)] [preco da fianca]");
                return 1;
            }
            new bail = strval(tmp);
            if(bail < 0 || bail > 1) { SendClientMessage(playerid, COR_CINZA, "   Fianзa Tem Que ser 0=Nгo ou 1=Sim !"); return 1; }
            tmp = strtok(cmd, idx);
            if(!strlen(tmp))
            {
               
                SendClientMessage(playerid, COR_BRANCO, "USE: /prender [id] [tempo (minutos)] [fianca (0=nao 1=sim)] [preco da fianca]");
                return 1;
            }
            new bailprice = strval(tmp);
            if(bailprice < 0 || bailprice > 300000) { SendClientMessage(playerid, COR_CINZA, "   O Preзo nгo pode ser menor que 0 nem maior que R$300000 !"); return 1; }
            new suspect = iddele;
            if(IsPlayerConnected(suspect))
            {
               
                if(GetDistanceBetweenPlayers(playerid,suspect) < 15)
                {
                   
                    if(BrunoInfo[playerid][pMembro] == 1 || BrunoInfo[playerid][pLider] == 1)
                    {
                       
                        if(WantedPoints[suspect] < 1)
                        {
                           
                            SendClientMessage(playerid, COR_CINZA, "   O Jogador deve ter no mнnimo 1 nнvel de procurado!");
                            return 1;
                        }
                        format(string, sizeof(string), "* Vocк Prendeu %s !", pNome(iddele));
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "Preso por %s", pNome(playerid));
                        GameTextForPlayer(suspect, string, 5000, 5);
                        ResetPlayerWeapons(suspect);
                        if(BrunoInfo[playerid][pMembro]==1||BrunoInfo[playerid][pLider]==1)
                        {
                           
                            format(string, sizeof(string), "<< Policial Militar %s prendeu o suspeito %s >>", pNome(playerid), pNome(iddele));
                            OOCNews(COR_VERMELHO, string);
                        }
                        SetPlayerInterior(suspect, 6);
                        SetPlayerPos(suspect,264.6288,77.5742,1001.0391);
                        BrunoInfo[suspect][pJailTime] = time * 60;
                        SetPlayerSkin(suspect, 42);
                        SetPlayerChatBubble(suspect, "*", COR_VERMELHO, 1, 1);
                        if(bail == 1)
                        {
                           
                            JailPrice[suspect] = bailprice;
                            format(string, sizeof(string), "Vocк foi preso por %d Segundos.   Fianзa: R$%d", BrunoInfo[suspect][pJailTime], JailPrice[suspect]);
                            SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
                        }
                        else
                        {
                           
                            JailPrice[suspect] = 0;
                            format(string, sizeof(string), "Vocк foi preso por %d Segundos.   Fianзa: Desativada", BrunoInfo[suspect][pJailTime]);
                            SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
                        }
                        BrunoInfo[suspect][pJailed] = 1;
                        SetPlayerFree(suspect,playerid, "Foi Preso");
                        WantedPoints[suspect] = 0;
                        SetPlayerWantedLevel(suspect, 0);
                        WantAdvogado[suspect] = 1;
                        BrunoInfo[suspect][pFita] = 0;
                        TogglePlayerControllable(suspect, 1);
                        PlayerCuffed[suspect] = 0;
                        BrunoInfo[suspect][pDroga] = 0;
                        return 1;
                    }
                    if(BrunoInfo[playerid][pMembro] == 3 || BrunoInfo[playerid][pLider] == 3)
                    {
                       
                        if(WantedPoints[suspect] < 1)
                        {
                           
                            SendClientMessage(playerid, COR_CINZA, "   O Jogador deve ter no minimo 1 nнvel de procura!");
                            return 1;
                        }
                        format(string, sizeof(string), "* Vocк Prendeu %s !", pNome(iddele));
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        //GivePlayerMoney(suspect, -moneys);
                        format(string, sizeof(string), "Preso por %s", pNome(playerid));
                        GameTextForPlayer(suspect, string, 5000, 5);
                        ResetPlayerWeapons(suspect);
                        if(BrunoInfo[playerid][pMembro]==3||BrunoInfo[playerid][pLider]==3)
                        {
                           
                            format(string, sizeof(string), "<< Exйrcito %s prendeu o suspeito %s >>", pNome(playerid), pNome(iddele));
                            OOCNews(COR_VERMELHO, string);
                        }
                        SetPlayerInterior(suspect, 0);
                        SetPlayerPos(suspect,-1293.2203,490.5885,11.1953);
                        BrunoInfo[suspect][pJailTime] = time * 60;
                        SetPlayerSkin(suspect, 42);
                        SetPlayerChatBubble(suspect, "*", COR_VERMELHO, 1, 1);
                        if(bail == 1)
                        {
                           
                            JailPrice[suspect] = bailprice;
                            format(string, sizeof(string), "Vocк foi preso por %d Segundos.   Fianзa: R$%d", BrunoInfo[suspect][pJailTime], JailPrice[suspect]);
                            SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
                        }
                        else
                        {
                           
                            JailPrice[suspect] = 0;
                            format(string, sizeof(string), "Vocк foi preso por %d Segundos.   Fianзa: Desativada", BrunoInfo[suspect][pJailTime]);
                            SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
                        }
                        BrunoInfo[suspect][pJailed] = 7;
                        SetPlayerFree(suspect,playerid, "Foi Preso");
                        WantedPoints[suspect] = 0;
                        SetPlayerWantedLevel(suspect, 0);
                        WantAdvogado[suspect] = 1;
                        TogglePlayerControllable(suspect, 1);
                        BrunoInfo[suspect][pFita] = 0;
                        PlayerCuffed[suspect] = 0;
                        BrunoInfo[suspect][pDroga] = 0;
                        return 1;
                    }
                    else
                    {
                       
                        SendClientMessage(playerid, COR_CINZA, "   Esse nгo й um jogador ativo.");
                        return 1;
                    }
                }
            }
        }
        else
        {
           
            SendClientMessage(playerid, COR_CINZA, "   Vocк nгo й um Oficial !");
            return 1;
        }
    }
    return 1;
}//not connecte
ajuda ae
Reply
#2

pawn Код:
COMMAND:prender ( playerid, params[] ) {

    new yID, yTempo, yFianca, yPrecoFianca;
   
    if ( sscanf ( params, "udd", yID, yTempo, yFianca, yPrecoFianca ) )
        return SendClientMessage ( playerid, -1, "[ USE ]: /prender [ID] [Tempo] [Fianзa] [Preзo Fianзa]" ) ;
       
       
    // RESTO DA FUNЗГO
    return true ;
}
Reply
#3

try

pawn Код:
CMD:prender(playerid, params[])
{
    new id, string[128];
    if(IsPlayerConnected(playerid) && IsACop(playerid))
    {
        if(OnDuty[playerid] != 1) return SendClientMessage(playerid, COR_CINZA, "   Vocк nгo Bateu o cartгo!");
       
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Erro: ID nao conetado");

        if(!PlayerToPoint(12.0, playerid, 268.3327,77.8972,1001.0391) && !PlayerToPoint(12.0, playerid, 1545.4073,-1607.9791,13.3828) && !PlayerToPoint(12.0, playerid, 324.3141,-1496.9177,24.9219)
        && !PlayerToPoint(12.0, playerid, 920.5212,-1184.8267,16.9766) &&  !PlayerToPoint(12.0, playerid, 221.1459,115.3492,999.0156) && !PlayerToPoint(12.0, playerid, 193.9101,179.2799,1003.0234)
        && !PlayerToPoint(12.0, playerid, 1545.7220,-1609.4769,13.3828) && !PlayerToPoint(12.0, playerid, 1019.6051,-317.6436,73.9922) && !PlayerToPoint(12.0, playerid, 195.5733,158.4008,1003.0234)
        && !PlayerToPoint(12.0, playerid, 1410.2281,413.0080,19.7578) && !PlayerToPoint(12.0, playerid, -1298.8188,490.5014,11.1953) && !PlayerToPoint(12.0, playerid, 264.1557,77.5797,1001.0391)
        && !PlayerToPoint(12.0, playerid, 1361,175.1075,1003.0234) && !PlayerToPoint(12.0, playerid, 321.8284,315.6733,999.1484) && !PlayerToPoint(12.0, playerid, 1807.5519,-1689.7974,13.5461)
        && !PlayerToPoint(12.0, playerid, 899.5557,-1206.2456,16.9766) && !PlayerToPoint(12.0, playerid, -509.7748,-557.3786,25.5234))
        {
            SendClientMessage(playerid, COR_CINZA, "   Vocк nгo estб perto da cela, nгo pode prender o suspeito !");
            return 1;
        }
        if(sscanf(params, "uddd", id, time, bail, bailprice )) return SendClientMessage(playerid, COR_BRANCO, "USE: /prender [id] [time (minutos)] [bail (0=nao 1=sim)] [preco da bail]");

        if(time < 1 || time > 20) return SendClientMessage(playerid, COR_CINZA, "   O time nгo pode ser menor que 1 nem maior que 20 !");
           
        if(bail < 0 || bail > 1) return SendClientMessage(playerid, COR_CINZA, "   Fianзa Tem Que ser 0=Nгo ou 1=Sim !");
           
        if(bailprice  < 0 || bailprice  > 300000) return SendClientMessage(playerid, COR_CINZA, "   O Preзo nгo pode ser menor que 0 nem maior que R$300000 !");
           
        if(GetDistanceBetweenPlayers(playerid, id) < 15)
        {
            if(BrunoInfo[playerid][pMembro] == 1 || BrunoInfo[playerid][pLider] == 1)
            {
                if(WantedPoints[id] < 1) return SendClientMessage(playerid, COR_CINZA, "   O Jogador deve ter no mнnimo 1 nнvel de procurado!");
                       
                format(string, sizeof(string), "* Vocк Prendeu %s !", pNome(id));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "Preso por %s", pNome(playerid));
                GameTextForPlayer(id, string, 5000, 5);
                ResetPlayerWeapons(id);
                if(BrunoInfo[playerid][pMembro]==1||BrunoInfo[playerid][pLider]==1)
                {
                    format(string, sizeof(string), "<< Policial Militar %s prendeu o suspeito %s >>", pNome(playerid), pNome(id));
                    OOCNews(COR_VERMELHO, string);
                }
                SetPlayerInterior(id, 6);
                SetPlayerPos(id,264.6288,77.5742,1001.0391);
                BrunoInfo[id][time] = time * 60;
                SetPlayerSkin(id, 42);
                SetPlayerChatBubble(id, "*", COR_VERMELHO, 1, 1);
                if(bail == 1)
                {
                    JailPrice[id] = bailprice ;
                    format(string, sizeof(string), "Vocк foi preso por %d Segundos.   Fianзa: R$%d", BrunoInfo[id][time], JailPrice[id]);
                    SendClientMessage(id, COLOR_LIGHTBLUE, string);
                }
                else
                {
                    JailPrice[id] = 0;
                    format(string, sizeof(string), "Vocк foi preso por %d Segundos.   Fianзa: Desativada", BrunoInfo[id][time]);
                    SendClientMessage(id, COLOR_LIGHTBLUE, string);
                }
                BrunoInfo[id][pJailed] = 1;
                SetPlayerFree(id,playerid, "Foi Preso");
                WantedPoints[id] = 0;
                SetPlayerWantedLevel(id, 0);
                WantAdvogado[id] = 1;
                BrunoInfo[id][pFita] = 0;
                TogglePlayerControllable(id, 1);
                PlayerCuffed[id] = 0;
                BrunoInfo[id][pDroga] = 0;
                return 1;
            }
            if(BrunoInfo[playerid][pMembro] == 3 || BrunoInfo[playerid][pLider] == 3)
            {
                if(WantedPoints[id] < 1) return SendClientMessage(playerid, COR_CINZA, "   O Jogador deve ter no minimo 1 nнvel de procura!");
                           
                format(string, sizeof(string), "* Vocк Prendeu %s !", pNome(id));
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                //GivePlayerMoney(id, -moneys);
                format(string, sizeof(string), "Preso por %s", pNome(playerid));
                GameTextForPlayer(id, string, 5000, 5);
                ResetPlayerWeapons(id);
                if(BrunoInfo[playerid][pMembro]==3||BrunoInfo[playerid][pLider]==3)
                {
                    format(string, sizeof(string), "<< Exйrcito %s prendeu o suspeito %s >>", pNome(playerid), pNome(id));
                    OOCNews(COR_VERMELHO, string);
                }
                SetPlayerInterior(id, 0);
                SetPlayerPos(id,-1293.2203,490.5885,11.1953);
                BrunoInfo[id][time] = time * 60;
                SetPlayerSkin(id, 42);
                SetPlayerChatBubble(id, "*", COR_VERMELHO, 1, 1);
                if(bail == 1)
                {
                    JailPrice[id] = bailprice ;
                    format(string, sizeof(string), "Vocк foi preso por %d Segundos.   Fianзa: R$%d", BrunoInfo[id][time], JailPrice[id]);
                    SendClientMessage(id, COLOR_LIGHTBLUE, string);
                }
                else
                {
                    JailPrice[id] = 0;
                    format(string, sizeof(string), "Vocк foi preso por %d Segundos.   Fianзa: Desativada", BrunoInfo[id][time]);
                    SendClientMessage(id, COLOR_LIGHTBLUE, string);
                }
                BrunoInfo[id][pJailed] = 7;
                SetPlayerFree(id,playerid, "Foi Preso");
                WantedPoints[id] = 0;
                SetPlayerWantedLevel(id, 0);
                WantAdvogado[id] = 1;
                TogglePlayerControllable(id, 1);
                BrunoInfo[id][pFita] = 0;
                PlayerCuffed[id] = 0;
                BrunoInfo[id][pDroga] = 0;
                return 1;
            }
        }
    }    
    else return SendClientMessage(playerid, COR_CINZA, "   Vocк nгo й um Oficial !");
    return 1;
}
espero n ter errado
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)