SA-MP Forums Archive
Closer chat for RP. + REP. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Closer chat for RP. + REP. (/showthread.php?tid=482374)



Closer chat for RP. + REP. - DemME - 20.12.2013

I just wanted to say, that I would like to disable the regular chat, and to exchange it with RolePlay chat, as you played already in RP server, you saw that it goes trought ' CLOSER CHAT ' only people that 10m or so can hear you.
If someone will make me the command I'll +REP.


Re: Closer chat for RP. + REP. - Zamora - 20.12.2013

Its not a command.. Check below OnPlayerText in your gm..


Re: Closer chat for RP. + REP. - DemME - 20.12.2013

Quote:
Originally Posted by Zamora
Посмотреть сообщение
Its not a command.. Check below OnPlayerText in your gm..
I know it's not a command, I didn't even worte " Gimme the command " I just said, how I can do this when players talking in the regular chat, it will be on radius of 10-15m and with white dirty color.


Re: Closer chat for RP. + REP. - iFiras - 20.12.2013

Use GetDistanceBetweenPlayers
It's easy, try this command for example
pawn Код:
CMD:w(playerid,params[])
{
    new string[128];
    if(!strlen(params))
    {
        SendClientMessage(playerid,-1,"[USAGE] {FFFFFF}/w [MESSAGE]");
        return 1;
    }
    format(string, sizeof(string), "<Whisper>: %s(%d): %s",PlayerName(playerid),playerid,params);
    printf("%s", string);
    IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10)
        {
            format(string, sizeof(string), "<Whisper> %s(%d): {FFFFFF}%s",PlayerName(playerid),playerid,params);
            SendClientMessage(i,-1,string);
        }
    }
    return 1;
}



Re: Closer chat for RP. + REP. - Zamora - 20.12.2013

You said make me a command .

Whatever.. Show me your OnPlayerText.


Re: Closer chat for RP. + REP. - DemME - 20.12.2013

Quote:
Originally Posted by Zamora
Посмотреть сообщение
You said make me a command .

Whatever.. Show me your OnPlayerText.
Empty, started from zero precent.


Re: Closer chat for RP. + REP. - Mitchy - 20.12.2013

pawn Код:
stock CloseMessage(playerid, color, string[])
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            if(IsPlayerInRangeOfPoint(i, 10.0, x, y, z))
            {
                if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
                {
                    if(GetPlayerInterior(playerid) == GetPlayerInterior(i))
                    {
                        SendClientMessage(i, color, string);
                    }
                }
            }
        }
    }
Add this under OnPlayerText: CloseMessage(playerid, WHITE, text);


Re: Closer chat for RP. + REP. - Zamora - 20.12.2013

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    format(string, sizeof (string), " %s: %s",  name, text);
    SendNearbyMessage(playerid, 10, string, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE);
    return 0;
}
Edit: Fixed Sendnearbymessage.


Re: Closer chat for RP. + REP. - FakkChass - 20.12.2013

Quote:
Originally Posted by iFiras
Посмотреть сообщение
Use GetDistanceBetweenPlayers
It's easy, try this command for example
pawn Код:
CMD:w(playerid,params[])
{
    new string[128];
    if(!strlen(params))
    {
        SendClientMessage(playerid,-1,"[USAGE] {FFFFFF}/w [MESSAGE]");
        return 1;
    }
    format(string, sizeof(string), "<Whisper>: %s(%d): %s",PlayerName(playerid),playerid,params);
    printf("%s", string);
    IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10)
        {
            format(string, sizeof(string), "<Whisper> %s(%d): {FFFFFF}%s",PlayerName(playerid),playerid,params);
            SendClientMessage(i,-1,string);
        }
    }
    return 1;
}
Use what he say ^


Re: Closer chat for RP. + REP. - DemME - 20.12.2013

Quote:
Originally Posted by FakkChass
Посмотреть сообщение
Use what he say ^
I didn't meant to say Whisper, or anything else, it's easy to build as much as Privte message and such, I wanted the OnPlayerText, to be as Zamora gave me earlier.