SA-MP Forums Archive
Chat help - 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: Chat help (/showthread.php?tid=309433)



Chat help - Artie_Scorpion - 07.01.2012

Hi how to make a chat like in rpg. when player is near then he will hear...
And another is how to make for ex.:
[12:00] Artie_Scorpion says: I'm leaving sorry
[12:02] Golden_Wolf says: k bye
[12:05] Artie_Scorpion has left the game....


Re: Chat help - BlackWolf120 - 07.01.2012

you mean a whisper cmd?

pawn Код:
dcmd_w(playerid, params[])
{
    new str[192], input[192], name[24];
    if(sscanf(params, "s[192]", input))return SendClientMessage(playerid, 0xFF0000FF, "Usage: /w [text]");
    GetPlayerName(playerid,name,24);
    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    format(str, 128, "[Whisper]%s(%d): %s",name, playerid, input);
    foreach (Player, i)
    {
        if(IsPlayerInRangeOfPoint(i,15,Pos[0],Pos[1],Pos[2]))
        {
            SendClientMessage(i, 0x00FFFFFF, str);
        }
    }
    return 1;
}
This one uses dcmd, sscanf and foreach.
But its easy to convert this code into other loops and cmds.


Re: Chat help - Artie_Scorpion - 07.01.2012

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
you mean a whisper cmd?

pawn Код:
dcmd_w(playerid, params[])
{
    new str[192], input[192], name[24];
    if(sscanf(params, "s[192]", input))return SendClientMessage(playerid, 0xFF0000FF, "Usage: /w [text]");
    GetPlayerName(playerid,name,24);
    new Float:Pos[3];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    format(str, 128, "[Whisper]%s(%d): %s",name, playerid, input);
    foreach (Player, i)
    {
        if(IsPlayerInRangeOfPoint(i,15,Pos[0],Pos[1],Pos[2]))
        {
            SendClientMessage(i, 0x00FFFFFF, str);
        }
    }
    return 1;
}
This one uses dcmd, sscanf and foreach.
But its easy to convert this code into other loops and cmds.
No...
Just for example:
[19:05] Artie_Scorpion: Can you give me admin?
[19:08] Charlie_Adams: Ok 1 sec
[19:11] Admin Charlie_Adams gave you admin...


Re: Chat help - Artie_Scorpion - 07.01.2012

help


Re: Chat help - Psymetrix - 07.01.2012

Your not being very clear about what you need!

**Written on forum**
pawn Код:
public OnPlayerText( playerid, text[] )
{
    new name[ MAX_PLAYER_NAME ], string[ 128 ];
    GetPlayerName( playerid, name, sizeof name );
    format( string, sizeof string, "%s(%d) says %s", name, playerid, text );
    SendClientMessageToAll( GetPlayerColor( playerid ), string );
    return 0;
}