[Help!] /me, /do and /ame commands!
#9

A simple /me, /do command filterscript with Strcmp ( slow command processor )

pawn Код:
#include < a_samp >

stock SendClosestMessage( playerid, color, const string[ ] )
{
    new
        Float: jPos[ 3 ]
    ;

    GetPlayerPos( playerid, jPos[ 0 ], jPos[ 1 ], jPos[ 2 ] );

    for ( new j = GetMaxPlayers( ), i; i < j; i ++ )
    {
        if ( !IsPlayerConnected( i ) )
            continue;

        if ( IsPlayerInRangeOfPoint( i, 5.0, jPos[ 0 ], jPos[ 1 ], jPos[ 2 ] ) )
        {
            SendClientMessage( i, color, string );
        }
    }

    return 1;
}

       

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if ( !strcmp( cmdtext, "/me", 3 ) )
    {
        if ( cmdtext[ 3 ] != ' ' || !cmdtext[ 4 ] )
            return SendClientMessage( playerid, -1, "Syntax: /me < action >" );
 
        new
            tempString[ 128 ],
            pName[ 24 ]
        ;

        GetPlayerName( playerid, pName, sizeof pName );

        format( tempString, sizeof tempString, "* %s %s", pName, cmdtext[ 3 ] );

        SendClosestMessage( playerid, -1, tempString );

        return 1;
    }

    if ( !strcmp( cmdtext, "/do", 3 ) )
    {
        if ( cmdtext[ 3 ] != ' ' || !cmdtext[ 4 ] )
            return SendClientMessage( playerid, -1, "Syntax: /do < action >" );
 
        new
            tempString[ 128 ],
            pName[ 24 ]
        ;

        GetPlayerName( playerid, pName, sizeof pName );

        format( tempString, sizeof tempString, "* (( %s )) %s", pName, cmdtext[ 3 ] );

        SendClosestMessage( playerid, -1, tempString );

        return 1;
    }

    return 0;
}
It's very simple!

EDIT: Added a "SendClosestMessage" function!
Reply


Messages In This Thread
[Help!] /me, /do and /ame commands! - by Gramercy Riffs - 12.07.2011, 22:04
Re: [Help!] /me, /do and /ame commands! - by dowster - 12.07.2011, 22:05
Re: [Help!] /me, /do and /ame commands! - by Gramercy Riffs - 12.07.2011, 22:06
Re: [Help!] /me, /do and /ame commands! - by dowster - 12.07.2011, 22:08
Re: [Help!] /me, /do and /ame commands! - by Kush - 12.07.2011, 22:09
Re: [Help!] /me, /do and /ame commands! - by Gramercy Riffs - 12.07.2011, 22:11
Re: [Help!] /me, /do and /ame commands! - by dowster - 12.07.2011, 22:14
Re: [Help!] /me, /do and /ame commands! - by Gramercy Riffs - 12.07.2011, 22:18
Re: [Help!] /me, /do and /ame commands! - by Basicz - 12.07.2011, 22:35
Re: [Help!] /me, /do and /ame commands! - by Daren_Jacobson - 12.07.2011, 23:13

Forum Jump:


Users browsing this thread: 2 Guest(s)