SA-MP Forums Archive
[ajuda] chat perto - 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] chat perto (/showthread.php?tid=336337)



[ajuda] chat perto - Markos - 22.04.2012

Como faзo um chat proximo.mas quando o player for distanciando. for ficando cinza
Exemplo:falo lo lado=branco.falo mais longe=branco escuro.falou mais longe ainda=cinza claro.e porai vai.valeu ae


Re: [ajuda] chat perto - Hellraiser1593 - 22.04.2012

intendi o que voce quer,mas nгo sei explicar,


Re: [ajuda] chat perto - Markos - 22.04.2012

ASHUHUASUHASUHSASHUHUSA
ta meio dificil fazer esse code.


Re: [ajuda] chat perto - Lуs - 22.04.2012

pawn Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public 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);
        //radi = 2.0; //Trigger Radius
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(!BigEar[i])
                {
                    GetPlayerPos(i, posx, posy, posz);
                    tempposx = (oldposx -posx);
                    tempposy = (oldposy -posy);
                    tempposz = (oldposz -posz);
                    //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,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);
                    }
                }
                else
                {
                    SendClientMessage(i, col1, string);
                }
            }
        }
    }//not connected
    return 1;
}
Retirado do GF.


Re: [ajuda] chat perto - Markos - 22.04.2012

nao funciono amigo,ta do mesmo jeito


Re: [ajuda] chat perto - @Riichard - 22.04.2012

Ve ae:
pawn Код:
public OnPlayerText(playerid, text[])
{
new Msg[128],Name[24],Float:Coords[3];
GetPlayerPos(playerid,Coords[0],Coords[1],Coords[2]);
GetPlayerName(playerid,Name,sizeof(Name));
format(Msg,sizeof(Msg),"%s diz: %s",Name,text);
for(new x = 0; x != MAX_PLAYERS; x++) {
if(IsPlayerInRangeOfPoint(x,10.0,Coords[0],Coords[1],Coords[2])) {
SendClientMessage(x,-1,Msg);
return 0;
}
GetPlayerPos(playerid,Coords[0],Coords[1],Coords[2]);
GetPlayerName(playerid,Name,sizeof(Name));
format(Msg,sizeof(Msg),"%s diz: %s",Name,text);
for(new x = 0; x != MAX_PLAYERS; x++)
{
if(IsPlayerInRangeOfPoint(x,100.0,Coords[0],Coords[1],Coords[2]))
{
SendClientMessage(x,0x836FFFAA,zstring);
return 0;
}
GetPlayerPos(playerid,Coords[0],Coords[1],Coords[2]);
GetPlayerName(playerid,Name,sizeof(Name));
format(Msg,sizeof(Msg),"%s diz: %s",Name,text);
for(new x = 0; x != MAX_PLAYERS; x++)
{
if(IsPlayerInRangeOfPoint(x,100.0,Coords[0],Coords[1],Coords[2]))
{
SendClientMessage(x,0xAFAFAFAA,zstring);
return 0;
}
GetPlayerPos(playerid,Coords[0],Coords[1],Coords[2]);
GetPlayerName(playerid,Name,sizeof(Name));
format(Msg,sizeof(Msg),"%s diz: %s",Name,text);
for(new x = 0; x != MAX_PLAYERS; x++)
{
if(IsPlayerInRangeOfPoint(x,800.0,Coords[0],Coords[1],Coords[2]))
{
SendClientMessage(x,0x363636AA,zstring);
return 0;
}
return 1;
}
Se der erro,e so adicionar os :
pawn Код:
new Msg[128],Name[24],Float:Coords[3];
Em cada um ..
Se for diferente avisa D:


Re: [ajuda] chat perto - Markos - 22.04.2012

deu certo,valeu ae
+rep pra vcs