Chat help
#1

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....
Reply
#2

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.
Reply
#3

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...
Reply
#4

help
Reply
#5

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)