[Ajuda] Chat local
#1

Esse codigo vai funcionar? й pra ser um chat local, so quem esta a 20.0 m do player pode ler.
Ps: totalmente criado por mim.
PsІ: Vagas Para Beta tester em um projeto mais info chamar skype.

PHP код:
public OnPlayerText(playeridtext[])
{
    new 
nome[23], str[128];
    new 
Floatpos[3];
    
GetPlayerName(playeridnomesizeof(nome));
    
format(str128"%s: %s"nometext);
    
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
    for( new 
i=0i<MAX_PLAYERSi++ )
    {
        if(
IsPlayerConnected(i))
        {
            if(
IsPlayerInRangeOfPoint(i20.0pos[0], pos[1], pos[2]))
            {
                
SendClientMessage(iCOR_CINZAstr);
            }
        }
    }
    return 
0;

Reply
#2

Use esse aqui, mais fбcil.

PHP код:
forward ProxDetector(Float:radiplayeridstring[], col1col2col3col4col5);
public 
ProxDetector(Float:radiplayeridstring[], col1col2col3col4col5)
{
    if(
IsPlayerConnected(playerid)) {
        new 
Float:posxFloat:posyFloat:posz;
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        new 
Float:tempposxFloat:tempposyFloat:tempposz;
        
GetPlayerPos(playeridoldposxoldposyoldposz);
        for(new 
0MAX_PLAYERSi++) {
            if(
IsPlayerConnected(i)) {
                
GetPlayerPos(iposxposyposz);
                
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(icol1string);
                }
                else if (((
tempposx radi/8) && (tempposx > -radi/8)) && ((tempposy radi/8) && (tempposy > -radi/8)) && ((tempposz radi/8) && (tempposz > -radi/8))) {
                    
SendClientMessage(icol2string);
                }
                else if (((
tempposx radi/4) && (tempposx > -radi/4)) && ((tempposy radi/4) && (tempposy > -radi/4)) && ((tempposz radi/4) && (tempposz > -radi/4))) {
                    
SendClientMessage(icol3string);
                }
                else if (((
tempposx radi/2) && (tempposx > -radi/2)) && ((tempposy radi/2) && (tempposy > -radi/2)) && ((tempposz radi/2) && (tempposz > -radi/2))) {
                    
SendClientMessage(icol4string);
                }
                else if (((
tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi))) {
                    
SendClientMessage(icol5string);
                }
            }
        }
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by moura98
Посмотреть сообщение
Esse codigo vai funcionar? й pra ser um chat local, so quem esta a 20.0 m do player pode ler.
Ps: totalmente criado por mim.
PsІ: Vagas Para Beta tester em um projeto mais info chamar skype.

PHP код:
public OnPlayerText(playeridtext[])
{
    new 
nome[23], str[128];
    new 
Floatpos[3];
    
GetPlayerName(playeridnomesizeof(nome));
    
format(str128"%s: %s"nometext);
    
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
    for( new 
i=0i<MAX_PLAYERSi++ )
    {
        if(
IsPlayerConnected(i))
        {
            if(
IsPlayerInRangeOfPoint(i20.0pos[0], pos[1], pos[2]))
            {
                
SendClientMessage(iCOR_CINZAstr);
            }
        }
    }
    return 
0;

Sim vai, uso da mesma forma sу que por comando nгo na public OnPlayerText


Quote:
Originally Posted by LockedLucas
Посмотреть сообщение
Use esse aqui, mais fбcil.

PHP код:
forward ProxDetector(Float:radiplayeridstring[], col1col2col3col4col5);
public 
ProxDetector(Float:radiplayeridstring[], col1col2col3col4col5)
{
    if(
IsPlayerConnected(playerid)) {
        new 
Float:posxFloat:posyFloat:posz;
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        new 
Float:tempposxFloat:tempposyFloat:tempposz;
        
GetPlayerPos(playeridoldposxoldposyoldposz);
        for(new 
0MAX_PLAYERSi++) {
            if(
IsPlayerConnected(i)) {
                
GetPlayerPos(iposxposyposz);
                
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(icol1string);
                }
                else if (((
tempposx radi/8) && (tempposx > -radi/8)) && ((tempposy radi/8) && (tempposy > -radi/8)) && ((tempposz radi/8) && (tempposz > -radi/8))) {
                    
SendClientMessage(icol2string);
                }
                else if (((
tempposx radi/4) && (tempposx > -radi/4)) && ((tempposy radi/4) && (tempposy > -radi/4)) && ((tempposz radi/4) && (tempposz > -radi/4))) {
                    
SendClientMessage(icol3string);
                }
                else if (((
tempposx radi/2) && (tempposx > -radi/2)) && ((tempposy radi/2) && (tempposy > -radi/2)) && ((tempposz radi/2) && (tempposz > -radi/2))) {
                    
SendClientMessage(icol4string);
                }
                else if (((
tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi))) {
                    
SendClientMessage(icol5string);
                }
            }
        }
    }
    return 
1;

Pra que tudo isso? Cуdigo do moura funcional...
Reply
#4

Poderia tentar fazer desse mйtodo:
PHP код:
stock ProxDetector(Float:radiusplayeridcolortext[])
{
    new 
Nome[MAX_PLAYER_NAME], textString[128], Float:xFloat:yFloat:z;
    
GetPlayerName(playeridNomeMAX_PLAYER_NAME);
    
GetPlayerPos(playeridxyz);
    
format(textStringsizeof textString"%s diz: %s"Nometext);
    for(new 
0MAX_PLAYERS; ++i)
    {
        if(
IsPlayerConnected(i))
        {
            if(
IsPlayerInRangeOfPoint(iradiusxyz))
            {
                
SendClientMessage(icolortextString);
            }
        }
    }

OBS: O cуdigo que eu passei vai funcionar da mesma forma que vocк fez aн.
Precisar de ajuda me chama no skype que eu to online.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)