[Ajuda] fio infinito
#1

Eae pessoal,beleza ?
Eu peguei um sistema de orelhao,mas o fio do telefeno й infinito.и assim vc digita /orelhao [numero] e pode ir pro outro lado do mapa que a chamada continua,e varias pessoas pode usar ao mesmo tempo.Resumindo: como coloco limite de distancia e 1 pessoa por vez ?segue o comando do orelhao (se precisar de alguma outra linha eu posto)
pawn Код:
if(strcmp(cmd, "/orelhao", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerToPoint(1.7, playerid,1535.5697,-1637.5358,13.5469) || PlayerToPoint(1.7, playerid,1710.8175,-1605.0188,13.5469) || PlayerToPoint(1.7, playerid,1808.1926,-1598.6720,13.5469) || PlayerToPoint(1.7, playerid,1611.2460,-1713.0765,13.5469) || PlayerToPoint(1.7, playerid,1362.9312,-1751.3467,13.5244) || PlayerToPoint(1.7, playerid,1804.5630,-1167.7408,23.8281) || PlayerToPoint(1.7, playerid,814.5628,-1355.5433,13.5414) ||
            PlayerToPoint(1.7, playerid,839.7822,-1339.5476,7.1719) || PlayerToPoint(1.7, playerid,522.3236,-1515.9530,14.5936) || PlayerToPoint(1.7, playerid,523.9922,-1525.5927,14.7482) || PlayerToPoint(1.7, playerid,547.3288,-1498.3148,14.4988) || PlayerToPoint(1.7, playerid,637.4054,-1228.4910,17.8721) || PlayerToPoint(1.7, playerid,356.4761,-1365.3461,14.4760) ||
            PlayerToPoint(1.7, playerid,338.9698,-1397.1982,14.2238) || PlayerToPoint(1.7, playerid,248.2463,-1448.8539,13.5899) || PlayerToPoint(1.7, playerid,2232.8149,-1165.7214,25.8906)  || PlayerToPoint(1.7, playerid,2219.9551,-1154.7574,1025.7969)
           || PlayerToPoint(1.7, playerid,1723.9048,-1720.7859,13.5437)  || PlayerToPoint(1.7, playerid,1720.4819,-1720.9020,13.5442))
            {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /orelhao [Nє TELEFONE]");
                return true;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s disca algum numero no telefone.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            new phonenumb = strval(tmp);
            if(phonenumb == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo estб ligando para ninguйm.");
                return true;
            }
            if(phonenumb == PlayerInfo[playerid][pPnumber])
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo pode ligar para si mesmo.");
                return true;
            }
            if(Mobile[playerid] != 255)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Voce ja estб em uma ligaзгo.");
                return true;
            }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
                    {
                        giveplayerid = i;
                        Mobile[playerid] = giveplayerid;
                        if(IsPlayerConnected(giveplayerid))
                        {
                            if(giveplayerid != INVALID_PLAYER_ID)
                            {
                                if(PhoneOnline[giveplayerid] > 0)
                                {
                                    SendClientMessage(playerid, COLOR_GREY, "O nъmero chamado estб fora de area,ou desligado.");
                                    return true;
                                }
                                if (Mobile[giveplayerid] == 255)
                                {
                                    format(string, sizeof(string), "Seu celular estб tocando (/At) Chamando: %s", PlayerName(playerid));
                                    SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                                    GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                                    RingTone[giveplayerid] = 10;
                                    format(string, sizeof(string), "O celular de %s,estб tocando.", PlayerName(playerid));
                                    PlayerPlaySound(giveplayerid, 1142, 0.0, 0.0, 0.0);
                                    PlayerPlaySound(playerid, 1142, 0.0, 0.0, 0.0);
                                    ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                    SendClientMessage(playerid, COLOR_MSG, "Use 'T' para falar, digite /des para desligar");
                                    CellTime[playerid] = 1;
                                    SBizzInfo[2][sbTill] += 500;
                                    ExtortionSBiz(2, 500);
                                    return true;
                                }
                            }
                        }
                    }
                }
            }
            SendClientMessage(playerid, COLOR_GRAD2, "O nъmero chamado estб ocupado.");}
        }
        return true;
    }
Obrigado a todos.
Reply
#2

Para impedir vбrias ligaзхes crie uma bool.
pawn Код:
new bool:usando;

//no comeзo do comando.
if(usando)
    return SendClientMessage(playerid, -1, "Alguem jб estб usando o orelhгo aguarde.");
//quando a ligaзгo for executada.
usando = true;

//quando acabar a ligaзгo
usando = false;
Para limitar a distвncia, apenas congele o player quando iniciar a ligaзгo, e descongele quando acabar.
Reply
#3

Valeu ae.Mas nem deu certo,o compilador para de funcionar.ficou assim os comandos:
pawn Код:
if(strcmp(cmd, "/orelhao", true) == 0)
{
        if(IsPlayerConnected(playerid))
        {
            if(PlayerToPoint(1.7, playerid,1535.5697,-1637.5358,13.5469) || PlayerToPoint(1.7, playerid,1710.8175,-1605.0188,13.5469) || PlayerToPoint(1.7, playerid,1808.1926,-1598.6720,13.5469) || PlayerToPoint(1.7, playerid,1611.2460,-1713.0765,13.5469) || PlayerToPoint(1.7, playerid,1362.9312,-1751.3467,13.5244) || PlayerToPoint(1.7, playerid,1804.5630,-1167.7408,23.8281) || PlayerToPoint(1.7, playerid,814.5628,-1355.5433,13.5414) ||
            PlayerToPoint(1.7, playerid,839.7822,-1339.5476,7.1719) || PlayerToPoint(1.7, playerid,522.3236,-1515.9530,14.5936) || PlayerToPoint(1.7, playerid,523.9922,-1525.5927,14.7482) || PlayerToPoint(1.7, playerid,547.3288,-1498.3148,14.4988) || PlayerToPoint(1.7, playerid,637.4054,-1228.4910,17.8721) || PlayerToPoint(1.7, playerid,356.4761,-1365.3461,14.4760) ||
            PlayerToPoint(1.7, playerid,338.9698,-1397.1982,14.2238) || PlayerToPoint(1.7, playerid,248.2463,-1448.8539,13.5899) || PlayerToPoint(1.7, playerid,2232.8149,-1165.7214,25.8906)  || PlayerToPoint(1.7, playerid,2219.9551,-1154.7574,1025.7969)
           || PlayerToPoint(1.7, playerid,1723.9048,-1720.7859,13.5437)  || PlayerToPoint(1.7, playerid,1720.4819,-1720.9020,13.5442))
            {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /orelhao [Nє TELEFONE]");
                return true;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s disca algum numero no telefone.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            new phonenumb = strval(tmp);
            if(phonenumb == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo estб ligando para ninguйm.");
                return true;
            }
            if(phonenumb == PlayerInfo[playerid][pPnumber])
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo pode ligar para si mesmo.");
                return true;
            }
            if(Mobile[playerid] != 255)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Voce ja estб em uma ligaзгo.");
                return true;
            }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
                    {
                        giveplayerid = i;
                        Mobile[playerid] = giveplayerid;
                        if(IsPlayerConnected(giveplayerid))
                        {
                            if(giveplayerid != INVALID_PLAYER_ID)
                            {
                                if(PhoneOnline[giveplayerid] > 0)
                                {
                                    SendClientMessage(playerid, COLOR_GREY, "O nъmero chamado estб fora de area,ou desligado.");
                                    return true;
                                }
                                if (Mobile[giveplayerid] == 255)
                                {
                                    format(string, sizeof(string), "Seu celular estб tocando (/At) Chamando: %s", PlayerName(playerid));
                                    SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                                    GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                                    RingTone[giveplayerid] = 10;
                                    format(string, sizeof(string), "O celular de %s,estб tocando.", PlayerName(playerid));
                                    PlayerPlaySound(giveplayerid, 1142, 0.0, 0.0, 0.0);
                                    PlayerPlaySound(playerid, 1142, 0.0, 0.0, 0.0);
                                    ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                    SendClientMessage(playerid, COLOR_MSG, "Use 'T' para falar, digite /des para desligar");
                                    CellTime[playerid] = 1;
                                    SBizzInfo[2][sbTill] += 500;
                                    ExtortionSBiz(2, 500);
                                    usando = true;
                                    TogglePlayerControllable(playerid,0);
                                    return true;
                                }
                            }
                        }
                    }
                }
            }
            SendClientMessage(playerid, COLOR_GRAD2, "O nъmero chamado estб ocupado.");}
        }
        return true;
    }
pawn Код:
if(strcmp(cmd, "/desligarorelhao", true) == 0 || strcmp(cmd, "/deso", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new caller = Mobile[playerid];
            if(IsPlayerConnected(caller))
            {
                if(caller != INVALID_PLAYER_ID)
                {
                    if(caller != 255)
                    {
                        if(caller < 255)
                        {
                            SendClientMessage(caller,  COLOR_GRAD2, "Desligou.");
                            CellTime[caller] = 0;
                            CellTime[playerid] = 0;
                            SendClientMessage(playerid,  COLOR_GRAD2, "Desligou.");
                            Mobile[caller] = 255;
                        }
                        Mobile[playerid] = 255;
                        CellTime[playerid] = 0;
                        RingTone[playerid] = 0;
                        usando = false;
                        TogglePlayerControllable(playerid,1);
                        return true;
                    }
                }
            }
            SendClientMessage(playerid,  COLOR_GRAD2, "Colocou o orelhгo no gancho.");
            new pSpecialAction = GetPlayerSpecialAction(playerid);
            if (pSpecialAction == SPECIAL_ACTION_USECELLPHONE)
            {
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
            }
        }
        return true;
    }
@edit:retirei o sendclient message,pq ele tava fazendo o pawn compiler parar de funcionar.
@edit(denovo):deu certo,mas no jogo,quando fala,sу aparece pra quem ta perto,nao fala pelo telefone.O que eu faзo ?
Reply
#4

Porquк pra ele nгo andar vocк nгo faz o cara congelar? Й mais simples, vai poupar mais linhas.

1. This forum requires that you wait 120 seconds between posts. Please try again in 44 seconds.
Reply
#5

Eu fiz sim amigo,esta ali.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)