[Ajuda] Chat prуximo
#1

Preciso de ajuda pra mudar isso

Quero que quando o player digite apareca somente para todos proximo a ele
Aqui esta como chat global, me ajudem

Code:
new string[256];
format(string,sizeof(string),"[ID: %d] %s",playerid,text);
SendPlayerMessageToAll(playerid,string);
return 0;
}
Reply
#2

Loop + IsPlayerInRangeOfPoint.
Reply
#3

Quote:
Originally Posted by GGsamp
View Post
Na callback OnPlayerText

if(text[0] == ';'){ChatProximo(playerid, COLOUR_CHATPROX, text[1]);return 0;}

Final do gm ou onde preferir

stock ChatProximo(playerid, color, const string[])
{
new output[128], pNameX[MAX_PLAYER_NAME],outadm[128],rawstring[128];
GetPlayerName(playerid, pNameX, sizeof(pNameX));

format(output, sizeof(output), "%s: (%i): %s", pNameX, playerid, string);
format(rawstring, sizeof(rawstring), "%s",string);

GetPlayerPos(playerid, PosX, PosY, PosZ);

format(outadm, sizeof(outadm), "CHATP >> %s: (%i): %s", pNameX,playerid,string);
for(new i; i < GetMaxPlayers(); i++){if(IsPlayerConnected(i)){
if(CallRemoteFunction("GetPlayerAdminLevel","i",i) >= 4){
if(!IsPlayerInRangeOfPoint(i, 20.0, PosX, PosY, PosZ)){
SendClientMessage(i, 0xFF9900AA, outadm);}}}}

for(new i; i < GetMaxPlayers(); i++){if(IsPlayerConnected(i)){
if(IsPlayerInRangeOfPoint(i, 20.0, PosX, PosY, PosZ)){
SendClientMessage(i, color, output);
PlayerPlaySound(i,1057,0.0,0.0,0.0);}}}
SetPlayerChatBubble(playerid, rawstring, COLOUR_CHATPROX, 20.0, 10000);

return 1;
}
Com essa callback, vai enviar a mensagem tambйm se o jogador nгo estiver prуximo.
Reply
#4

Eu utilizo essa, pois com essa pode configurar vбrias cores, dependendo da distвncia do jogador.

PHP Code:

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))
        {
            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 
1;
} 
Reply
#5

Quote:
Originally Posted by GGsamp
View Post
Na callback OnPlayerText

if(text[0] == ';'){ChatProximo(playerid, COLOUR_CHATPROX, text[1]);return 0;}

Final do gm ou onde preferir

stock ChatProximo(playerid, color, const string[])
{
new output[128], pNameX[MAX_PLAYER_NAME],outadm[128],rawstring[128];
GetPlayerName(playerid, pNameX, sizeof(pNameX));

format(output, sizeof(output), "%s: (%i): %s", pNameX, playerid, string);
format(rawstring, sizeof(rawstring), "%s",string);

GetPlayerPos(playerid, PosX, PosY, PosZ);

format(outadm, sizeof(outadm), "CHATP >> %s: (%i): %s", pNameX,playerid,string);
for(new i; i < GetMaxPlayers(); i++){if(IsPlayerConnected(i)){
if(CallRemoteFunction("GetPlayerAdminLevel","i",i) >= 4){
if(!IsPlayerInRangeOfPoint(i, 20.0, PosX, PosY, PosZ)){
SendClientMessage(i, 0xFF9900AA, outadm);}}}}

for(new i; i < GetMaxPlayers(); i++){if(IsPlayerConnected(i)){
if(IsPlayerInRangeOfPoint(i, 20.0, PosX, PosY, PosZ)){
SendClientMessage(i, color, output);
PlayerPlaySound(i,1057,0.0,0.0,0.0);}}}
SetPlayerChatBubble(playerid, rawstring, COLOUR_CHATPROX, 20.0, 10000);

return 1;
}
Sistema da Game-Mode do Bloody Vegas
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)