SA-MP Forums Archive
/me command +rep - 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: /me command +rep (/showthread.php?tid=524517)



/me command +rep - [SU]Spartan - 07.07.2014

Hello,
Can anyone give me /me [text] command?I will give you rep.


Re: /me command +rep - Timeless - 07.07.2014

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if(!
strcmp(cmdtext"/me"true3)) // 3 is the length of /me
    
{
        if(!
cmdtext[3])return SendClientMessage(playerid0xFF0000FF"USAGE: /me [action]");
        new 
str[128];
        
GetPlayerName(playeridstrsizeof(str));
        
format(strsizeof(str), "* %s %s"strcmdtext[4]);
        
SendClientMessageToAll(0xFFFF00AAstr);
        return 
1;
    }
    return 
0;




Re: /me command +rep - Stanford - 07.07.2014

pawn Код:
CMD:me(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerLoggedIn[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "You're not logged in yet!.");
            return 1;
        }
        new result[96], string[128];
        if(sscanf(params,"s[96]",result))
        {
            SendClientMessage(playerid, COLOR_WHITE, "STRUCTURE: /me [action]");
            return 1;
        }
        format(string, sizeof(string), "* %s %s", RemoveUnderScore(playerid), result);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    return 1;
}

stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        new invehicle[MAX_PLAYERS];
        new virtualworld = GetPlayerVirtualWorld(playerid);
        new interior = GetPlayerInterior(playerid);
        new vehicleid = GetPlayerVehicleID(playerid);
        new ivehicleid;
        if(vehicleid)
        {
            GetVehiclePos(vehicleid,oldposx,oldposy,oldposz);
        }
        else
        {
            GetPlayerPos(playerid, oldposx, oldposy, oldposz);
            vehicleid = GetPlayerVehicleID(playerid);
        }
        foreach(new i : Player)
        {
            if(IsPlayerConnected(i))
            {
                if(!BigEar[i])
                {
                    if(GetPlayerVirtualWorld(i) == virtualworld)
                    {
                        if((GetPlayerInterior(i) == interior))
                        {
                            if(vehicleid)
                            {
                                if(IsPlayerInVehicle(i,vehicleid)) invehicle[i] = 1;
                            }
                            if(!invehicle[i])
                            {
                                if(IsPlayerInAnyVehicle(i))
                                {
                                    ivehicleid = GetPlayerVehicleID(i);
                                    GetVehiclePos(ivehicleid,posx,posy,posz);
                                }
                                else
                                {
                                    GetPlayerPos(i,posx,posy,posz);
                                }
                                tempposx = (oldposx -posx);
                                tempposy = (oldposy -posy);
                                tempposz = (oldposz -posz);
                                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) SendClientMessage(i, col1, string);
                                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) SendClientMessage(i, col2, string);
                                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) SendClientMessage(i, col3, string);
                                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) SendClientMessage(i, col4, string);
                                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) SendClientMessage(i, col5, string);
                            }
                            else SendClientMessage(i, col1, string);
                        }
                    }
                }
                else SendClientMessage(i, col1, string);
            }
        }
    }
    return 1;
}
Include foreach and zcmd in top of your script.


Re: /me command +rep - Smileys - 07.07.2014

or a simple one

pawn Код:
CMD:me( playerid, params[ ] )
{
    new message[ 128 ];
    if( sscanf( params, "s[128]", message ) ) SendClientMessage( playerid, -1, "Usage: /me [message]" );
    new name[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, name, sizeof( name ) );
    format( message, sizeof( message ), "*** %s(%i): %s", name, playerid, message );
    SendClientMessageToAll( -1, message );
    return 1;
}
typed on phone, sorry for any typos


Re: /me command +rep - Diverse - 07.07.2014

Do not use the command Smiley wrote. This would send your format to every single player online. What you want to do is follow Stanfords instructions. (Although he only told you to include foreach and zcmd but w/e).


Re: /me command +rep - Smileys - 07.07.2014

Quote:
Originally Posted by Diverse
Посмотреть сообщение
Do not use the command Smiley wrote. This would send your format to every single player online. What you want to do is follow Stanfords instructions. (Although he only told you to include foreach and zcmd but w/e).
note sure but asfar as I know when you type /me [message] you WANT it to send to everyone online, don't ya? lol.


Re: /me command +rep - SickAttack - 07.07.2014

Lets get this straight.
- Timeless - Correct.
- Stanford - Incorrect.
- Smileys - Correct.
- Diverse - Incorrect x 2.

The command "/me" is supposed to send the message to all conected players. Just one issue tho, change the number of cells to 144, that will give you a perfect length.