SA-MP Forums Archive
[Help!] /me, /do and /ame commands! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help!] /me, /do and /ame commands! (/showthread.php?tid=268538)



[Help!] /me, /do and /ame commands! - Gramercy Riffs - 12.07.2011

Hello, I'm posting this because I am creating a roleplay server. I have got the map implemented, a good administrator system and a lot of good filterscripts in my server.

However, I'm in dire need of a /me, /do and /ame command. Could anyone supply those commands for me please? Bare in mind: This is a roleplay server, so they all have to have a close proximity on them.

Thank you very much, I appreciate the work!


Re: [Help!] /me, /do and /ame commands! - dowster - 12.07.2011

which command processor are you using?


Re: [Help!] /me, /do and /ame commands! - Gramercy Riffs - 12.07.2011

What do you mean? (Sorry, rather new to all this scripting stuff, haha.)


Re: [Help!] /me, /do and /ame commands! - dowster - 12.07.2011

Then if you are new i would first suggest that you start with something small, like a DM gamemode.
Most people here will not explicitly make commands for someone who doesn't know the basics, or will not want to learn from it. Not being angry, just saying, read up a little and start small, a RP server takes a ton of work to get coded.


Re: [Help!] /me, /do and /ame commands! - Kush - 12.07.2011

https://sampforum.blast.hk/showthread.php?tid=91354 <-- Is an example of a command processor.


Re: [Help!] /me, /do and /ame commands! - Gramercy Riffs - 12.07.2011

Thank you very much.

I know that RP servers are hard too code, however this server doesn't need a complex script (the server is based on a very, very small map). All we need is a fully working /me, /do and /ame and we're off.


Re: [Help!] /me, /do and /ame commands! - dowster - 12.07.2011

Well I'm afraid i cannot be of much help because it looks like you are using the built in command processor, and I forgot that when I moved to ZCMD and Y_command. If you're using one of those i'd be able to help


Re: [Help!] /me, /do and /ame commands! - Gramercy Riffs - 12.07.2011

No worries, I'll search around for some then.


Re: [Help!] /me, /do and /ame commands! - Basicz - 12.07.2011

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!


Re: [Help!] /me, /do and /ame commands! - Daren_Jacobson - 12.07.2011

Quote:
Originally Posted by Basicz
Посмотреть сообщение
with Strcmp ( slow command processor )
First, strcmp is not a command processor, it simply compares two strings and returns 0 if they are equal or returns a positive or negative number depending on which string is "Larger."

Second, strcmp is not slow, if I had only one command on my server (and using strcmp to check typed text) it would probably be faster than any other method, it would also maintain this speed if it was at the top of the list (supposing you use else if for the rest of the commands.)