[Ajuda] Mandando 2 VEZ, Chat Local.
#1

Olб galera, hj criei um sistema de chat local que ao digitar ;mensagem aparece sу pra quem estб perto o problema que ele estб enviando no chat local, e no global. e nгo quero isso. eu quero envie sу quando der: "; oi" e quando der sу "oi" aparece no global e nгo to conseguindo ajuda ai??

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s {FFFFFF}[ID:%i]: %s", playername, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), string);
    if(text[0] == ';')
    {
     new Float:Pos[3], Name[24];
     new aString[256];
     GetPlayerName(playerid, Name, sizeof(Name));
     GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
     format(aString, sizeof(aString), "{007ACC}[CHAT LOCAL]: %s Disse: %s", Name, text[1]);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
     if(IsPlayerInRangeOfPoint(i, 50.0, Pos[0], Pos[1], Pos[2]))
     {
     SendClientMessage(i, -1, aString);
     }
     return 0;
     }
    }
    return 0;
}
Reply
#2

tenta assim

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s {FFFFFF}[ID:%i]: %s", playername, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), string);
    if(text[0] == ';')
    {
        new Float:Pos[3], Name[24],aString[256];
       
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
       
        format(aString, sizeof(aString), "{007ACC}[CHAT LOCAL]: %s Disse: %s", Name, text[1]);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerInRangeOfPoint(i, 50.0, Pos[0], Pos[1], Pos[2]))
            {
                SendClientMessage(i, -1, aString);
            }
        }
    }
    return 1;
}
Reply
#3

agr, ta mandando 3 vez s;
Reply
#4

Tenta ai!
Й problema de Return
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s {FFFFFF}[ID:%i]: %s", playername, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), string);
    if(text[0] == ';')
    {
        new Float:Pos[3], Name[24],aString[256];
       
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
       
        format(aString, sizeof(aString), "{007ACC}[CHAT LOCAL]: %s Disse: %s", Name, text[1]);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerInRangeOfPoint(i, 50.0, Pos[0], Pos[1], Pos[2]))
            {
                SendClientMessage(i, -1, aString);
                return 0;
            }
        }
        return 0;
    }
    return 0;
}
Reply
#5

pronto resolvido

pawn Код:
public OnPlayerText(playerid, text[])
{
    ChatProximo(playerid, text);
    return 0;
}

stock ChatProximo(playerid, text[])
{
    new Float:chatx, Float:chaty, Float:chatz, sert[256];
    GetPlayerPos(playerid, chatx, chaty, chatz);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 50.0, chatx, chaty, chatz))
            {
                format(sert, sizeof(sert), "[ID: %d] (») Chat Prуximo (») %s", playerid, text);
                SendPlayerMessageToPlayer(i, playerid, sert);
            }
        }
    }
    return 1;
}
Reply
#6

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s {FFFFFF}[ID:%i]: %s", playername, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), string);
    if(text[0] == ';')
    {
     new Float:Pos[3], Name[24];
     new aString[256];
     GetPlayerName(playerid, Name, sizeof(Name));
     GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
     format(aString, sizeof(aString), "{007ACC}[CHAT LOCAL]: %s Disse: %s", Name, text[1]);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
     if(IsPlayerInRangeOfPoint(i, 50.0, Pos[0], Pos[1], Pos[2]))
     {
     SendClientMessage(i, -1, aString);
     }
     return 0;
     }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)