[Pedido] Chat Local '-'
#1

Iae manins, suaves?

Eu queria pedir para vocкs, se alguem conhece um code de chat local, aqueles que quanto mais longe o player estб do outro, mais escuro a frase vai ficando, atй que atй uma certa distвncia o outro player nгo recebe mais a mensбgem... Eu dei uma pesquisada sobre ProxDetector mas eu nгo consegui entender nada, entгo se alguem puder me ajudar eu fico agradecido (:

Vlw gente...
Reply
#2

pawn Код:
forward ProxChat(Float:radi, playerid, string[],col1,col2,col3,col4,col5);

//onplayertext
ProxChat(/*distancia maxima */, playerid, string, cor1,cor2,cor3,cor4,cor5);

public ProxChat(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))
            {
                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 true;
}

//tive rperto cor1 e dai quanto mais longe vai aumentando cor2 cor3 ..etc
Reply
#3

Quote:
Originally Posted by Sky_.
Посмотреть сообщение
pawn Код:
forward ProxChat(Float:radi, playerid, string[],col1,col2,col3,col4,col5);

//onplayertext
ProxChat(/*distancia maxima */, playerid, string, cor1,cor2,cor3,cor4,cor5);

public ProxChat(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))
            {
                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 true;
}

//tive rperto cor1 e dai quanto mais longe vai aumentando cor2 cor3 ..etc
Essas col1, col2, col3... eu tenho que substituir com as cores nй? E pode me explicar melhor como usa isso? '-'
Reply
#4

sim vocк coloca as cores a serem usadas col1 й se tiver muito perto col2 um pouco mais longe col 3 se tiver mais longe ... col5 se tiver quase no maximo distancia que vc colocou! esses col1,2,3 vocк substitui por cores .. de seu gosto branco, zinza claro, zinza escuro, preto
Reply
#5

Blza.. vlw mano! Vou testar aqui...
Reply
#6

um exemplo de uso:

pawn Код:
//onplayertext
format(string, sizeof(string), "%s Diz: %s", PlayerName(playerid), text);
        ProxChat(30.0, playerid, string, Branco,ZinzaC,Zinzam,Zinzae,preto);
Reply
#7

Como eu uso isso?
pawn Код:
ProxChat(/*distancia maxima */, playerid, string, cor1,cor2,cor3,cor4,cor5);
Eu teria que criar 5 desses? colocando a distвncia mбxima diferenciada de cada um??
Reply
#8

pawn Код:
public OnPlayerText(playerid, text[])
{
    new Float:P[3];
    GetPlayerPos(playerid,P[0],P[1],P[2]);
    for(new i; i < MAX_PLAYERS; i++){

         if(IsPlayerInRangeOfPoint(i, 15.0, P[0], P[1], P[2])) return SendClientMessage(i,-1,text);
         if(IsPlayerInRangeOfPoint(i, 30.0, P[0], P[1], P[2])) return SendClientMessage(i,0xFF0000AA,text);
    }
    return 1;
}
Ps: Segundo parвmetro do IsPlayerInRangeOfPoint й o raio. Altere-o para o valor que preferir.

#Edit: Interpretei errado seu texto, vocк pode usar ProxDetector, ou poderб utilizar o exemplo acima e ir fazendo mais "condiзхes".
Reply
#9

pawn Код:
#define Branco 0xFFFFFFAA
#define Cinza 0x660000AA
#define Cinza1 0x66000085
#define Cinza2 0x66000065
#define Preto 0x00000085
public OnPlayerText(playerid, text[])
{
    new string[145];
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    //onplayertext
    format(string, sizeof(string), "%s Diz: %s", aname, text);
    ProxChat(30.0, playerid, string, Branco,Cinza,Cinza1,Cinza2,preto);
    return 0;
}
Reply
#10

Quote:
Originally Posted by D4rk
Посмотреть сообщение
pawn Код:
#define Branco 0xFFFFFFAA
#define Cinza 0x660000AA
#define Cinza1 0x66000085
#define Cinza2 0x66000065
#define Preto 0x00000085
public OnPlayerText(playerid, text[])
{
    new string[145];
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    //onplayertext
    format(string, sizeof(string), "%s Diz: %s", aname, text);
    ProxChat(30.0, playerid, string, Branco,Cinza,Cinza1,Cinza2,preto);
    return 0;
}
Warns:
Код:
C:\Documents and Settings\Kieryce\Desktop\HeyHoLeysGo Trabalhos\gamemodes\GM.pwn(349) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Kieryce\Desktop\HeyHoLeysGo Trabalhos\gamemodes\GM.pwn(349) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Kieryce\Desktop\HeyHoLeysGo Trabalhos\gamemodes\GM.pwn(349) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Kieryce\Desktop\HeyHoLeysGo Trabalhos\gamemodes\GM.pwn(349) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Kieryce\Desktop\HeyHoLeysGo Trabalhos\gamemodes\GM.pwn(349) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Kieryce\Desktop\HeyHoLeysGo Trabalhos\gamemodes\GM.pwn(3037) : error 010: invalid function or declaration
C:\Documents and Settings\Kieryce\Desktop\HeyHoLeysGo Trabalhos\gamemodes\GM.pwn(3038) : error 010: invalid function or declaration

Linhas:

pawn Код:
ProxChat(30.0, playerid, string, Branco,Cinza,Cinza1,Cinza2,Preto); //<~~~~~~ 349

forward ProxChat(Float:radi, playerid, string[],0xFFFFFFFF,0xE8E8E8FF,0xD1D1D1FF,0xC2C2C2FF,0xB0B0B0FF); // <~~~~~~ 3037
public ProxChat(Float:radi, playerid, string[],0xFFFFFFFF,0xE8E8E8FF,0xD1D1D1FF,0xC2C2C2FF,0xB0B0B0FF) //<~~~~~~ 3038

Ajuda? '-'


@@@@@@ EDIT @@@@@@
Jб arrumei! REP+ pros que ajudaram... vlw!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)