[Ajuda] [ERRO] Ao Algemar de perto.
#1

Olб Pessoal da Board. Estou com um problema que nгo consigo resolver... Tenho em mente que seja ( col1, col2, col3, col4, col5). Mais nгo sei o que em caixa na linha. Poderiam me ajudar? Obrigado

Linha:
pawn Код:
if(ProxDetector(8.0, playerid, ID_OUTRO_JOGADOR)) return SendClientMessage(playerid, VERMELHO_BEM_CLARO , "Fique perto do suspeito para poder algemar ele.");
ERRO:
pawn Код:
error 035: argument type mismatch (argument 3)
Stock's
pawn Код:
ProxDetector(Float:radi, playerid, string[], col1, col2, col3, col4, col5)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid) && GetPlayerInterior(i) == GetPlayerInterior(playerid)) // This checks if the virtual world and interior are the same with the playerid
        {
            if(IsPlayerInRangeOfPoint(i, radi/16,oldposx, oldposy, oldposz)) SendClientMessage(i, col1, string);
            else if(IsPlayerInRangeOfPoint(i, radi/8,oldposx, oldposy, oldposz)) SendClientMessage(i, col2, string);
            else if(IsPlayerInRangeOfPoint(i, radi/4,oldposx, oldposy, oldposz)) SendClientMessage(i, col3, string);
            else if(IsPlayerInRangeOfPoint(i, radi/2,oldposx, oldposy, oldposz)) SendClientMessage(i, col4, string);
            else if(IsPlayerInRangeOfPoint(i, radi,oldposx, oldposy, oldposz)) SendClientMessage(i, col5, string);
        }
    }
    return true;
}
Reply
#2

pawn Код:
stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}
Tenta inserir esse.
Reply
#3

Assumindo que ID_OUTRO_JOGADOR seja uma string, o erro estб apenas no que vocк mesmo citou. Vocк nгo passou nenhum parвmetro para preencher a funзгo, sendo eles col1, col2, etc.

Vocк pode fazer uma prй-atribuiзгo, da seguinte forma
pawn Код:
ProxDetector(Float:radi, playerid, string[], col1 = AZUL, col2 = VERMELHO, col3 = VERDE, col4 = PRETO,  col5 = AMARELO)
Desta forma, esse parвmetros passam a ser opcionais.
*Lembrando que os nomes das cores foi apenas um exemplo sugestivo, vocк pode utilizar da forma citada, basta utilizar macros.

Abraзos.
Reply
#4

Quote:
Originally Posted by Dolby
Посмотреть сообщение
Assumindo que ID_OUTRO_JOGADOR seja uma string, o erro estб apenas no que vocк mesmo citou. Vocк nгo passou nenhum parвmetro para preencher a funзгo, sendo eles col1, col2, etc.

Vocк pode fazer uma prй-atribuiзгo, da seguinte forma
pawn Код:
ProxDetector(Float:radi, playerid, string[], col1 = AZUL, col2 = VERMELHO, col3 = VERDE, col4 = PRETO,  col5 = AMARELO)
Desta forma, esse parвmetros passam a ser opcionais.
*Lembrando que os nomes das cores foi apenas um exemplo sugestivo, vocк pode utilizar da forma citada, basta utilizar macros.

Abraзos.
Bom fiz desta maneira, mais o erro ainda persiste
pawn Код:
if(ProxDetector(8.0, playerid, ID_OUTRO_JOGADOR, VERMELHO_BEM_CLARO,VERMELHO_BEM_CLARO,VERMELHO_BEM_CLARO,VERMELHO_BEM_CLARO,VERMELHO_BEM_CLARO)) return SendClientMessage(playerid, VERMELHO_BEM_CLARO , "Fique perto do suspeito para poder algemar ele.");
Reply
#5

Certifique-se de os parвmetros estarem corretos em sua definiзгo. Tambйm tenha certeza que ID_OUTRO_JOGADOR seja uma string.
Reply
#6

Quote:
Originally Posted by Dolby
Посмотреть сообщение
Certifique-se de os parвmetros estarem corretos em sua definiзгo. Tambйm tenha certeza que ID_OUTRO_JOGADOR seja uma string.
Olhe o meu cmd:

pawn Код:
CMD:algemar(playerid, params[])
{
    new ID_OUTRO_JOGADOR;
    if(DadosJogador[playerid][ORGANIZACAO_JOGADOR] == POLICIA_MILITAR)
    {
        if(sscanf(params, "u", ID_OUTRO_JOGADOR)) return SendClientMessage(playerid, VERDE_BEM_CLARO, "USE: /algemar [ID]");
        if(!IsPlayerConnected(ID_OUTRO_JOGADOR)) return SendClientMessage(playerid, VERMELHO_BEM_CLARO , "Jogador(a) nгo estб conectado.");
        if(ID_OUTRO_JOGADOR == playerid) return SendClientMessage(playerid, VERDE_BEM_CLARO, "Vocк nгo pode si algemar.");
        if(DadosJogador[playerid][VERIFICAR_MODO_ADMIN] == 1 && DadosJogador[playerid][ADMIN_NIVEL] >= 1) return return SendClientMessage(playerid, VERDE_BEM_CLARO, "Vocк nгo pode algemar admin em modo de trabalho.");

        //if(ProxDetector(ID_OUTRO_JOGADOR,playerid) < 8) return SendClientMessage(playerid, VERMELHO_BEM_CLARO , "Fique perto do suspeito para poder algemar ele.");

        if(Policiais_do_Servidor(ID_OUTRO_JOGADOR)) return SendClientMessage(playerid, VERMELHO_BEM_CLARO , "Vocк nгo pode algemar Policiais.");
        if(Bater_Cartao[playerid] == false) return SendClientMessage(playerid,VERMELHO_BEM_CLARO,"Vocк precisa bater o cartгo para poder algemar algum suspeito.");
        if(Jogador_Algemado[ID_OUTRO_JOGADOR] == true) return SendClientMessage(playerid,VERMELHO_BEM_CLARO,"O Jogador jб estб algemado.");
        if(DadosJogador[ID_OUTRO_JOGADOR][NIVEL_PROCURADO] < 1) return SendClientMessage(playerid,VERMELHO_BEM_CLARO,"O Suspeito precisa estar com nivel de procurado para ser algemado.");
        Jogador_Algemado[ID_OUTRO_JOGADOR] = true; //Algemas_Suspeito
       

       
    }
    else
    {
        SendClientMessage(playerid, VERMELHO_BEM_CLARO, "Vocк nгo esta autorizado a usar este comando.");
    }
    return true;
}
Reply
#7

Й como eu disse, vocк tentou passar um inteiro onde deveria passar uma string/texto.

Mas vocк utilizou a funзгo errada, a correta seria
Reply
#8

Quote:
Originally Posted by Dolby
Посмотреть сообщение
Й como eu disse, vocк tentou passar um inteiro onde deveria passar uma string/texto.

Mas vocк utilizou a funзгo errada, a correta seria
Assim ficaria bom nй
pawn Код:
new Float:x, Float:y, Float:z;
                        GetPlayerPos(playa,x,y,z);
                        if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
Reply
#9

Vlw Dolby .
Reply
#10

Alguйm ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)