Command issue
#8

Here, this should do it.

Notice, this command uses ZCMD and SSCANF2. Change the colors.

pawn Код:
command(me, playerid, params[])
{
    new Message[128], string[128];
    if( sscanf( params, "s[128]", Message) )
    {
        SendClientMessage( playerid, COLOR_WHITE, "SYNTAX: /me [action]" );
    }
    else
    {
        format( string, sizeof( string ), "* %s %s", GetPlayerNameEx( playerid ), Message);
        NearByMessage( playerid, COLOR_PURPLE, string);
    }
    return 1;
}
This is the custom function to make it work.

pawn Код:
forward NearByMessage(playerid, color, String[]);
public NearByMessage( playerid, color, String[])
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ, string[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected( i ))
        {
            GetPlayerPos( playerid, PlayerX, PlayerY, PlayerZ);
            if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ) )
            {
                if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) && GetPlayerInterior( playerid ) == GetPlayerInterior( i ) )
                {
                    SendClientMessage(i, color, string);
                }
            }
        }
    }
    return 1;
}

forward NearByMessageEx(playerid, color, String[], Float: range);
public NearByMessageEx( playerid, color, String[], Float: range)
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ, string[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected( i ) )
        {
            GetPlayerPos( playerid, PlayerX, PlayerY, PlayerZ);
            if(IsPlayerInRangeOfPoint(i, range, PlayerX, PlayerY, PlayerZ) )
            {
                if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) )
                {
                    SendClientMessage(i, color, string);
                }
            }
        }
    }
}

stock GetPlayerNameEx(playerid)
{
    new str[24], String[128];
    GetPlayerName(playerid,String,24);
    strmid(str,String,0,strlen(String),24);
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if (str[i] == '_') str[i] = ' ';
    }
    return str;
}
Reply


Messages In This Thread
Command issue - by Scriptissue - 28.09.2010, 11:57
Re: Command issue - by Voldemort - 28.09.2010, 12:02
Re: Command issue - by DarkPower - 28.09.2010, 12:11
Re: Command issue - by mmrk - 28.09.2010, 12:16
Re: Command issue - by Scriptissue - 28.09.2010, 13:17
Re: Command issue - by <Weponz> - 28.09.2010, 13:42
Re: Command issue - by Scriptissue - 28.09.2010, 15:39
Re: Command issue - by Scenario - 28.09.2010, 16:01
Re: Command issue - by Scriptissue - 29.09.2010, 07:35
Re: Command issue - by samgreen - 29.09.2010, 07:42

Forum Jump:


Users browsing this thread: 1 Guest(s)