/me command
#10

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
Hey, I just made one for you! Change the colour if you want:


pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
        SendClientMessageToAll(0xFFFF00AA, str);
        return 1;
    }
    return 0;
}
Hope I could help!
This sends the message to all the player's online. This is not what he wants, he only wants it for people near the person.

Colors
pawn Код:
#define COLOR_LIGHTGRAY                 0xD3D3D3FF
#define RP_CHATS            0xBE9BC1FF
Add this on top of your script.
pawn Код:
stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(!IsPlayerConnected(i))continue;
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z)) SendClientMessage(i,color,string);
    }
}
Now this is the /me command. It works better than TwistedInsane's because it only sends the /me message to players who are near.

pawn Код:
CMD:me(playerid, params[])
{
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof(name));
    strreplace(name,'_',' ');
    if(sscanf(params,"s[128]",str)) return SendClientMessage(playerid,COLOR_LIGHTGRAY,"USAGE: /me [action]");
    format(str,sizeof(str),"*%s %s",name, params);
    ProxDetector(30.0, playerid, str, RP_CHATS);
    return 1;
}
Almost forgot add this string replacer to replace the _ in a RP name to the top of your script as well.
pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++) {
        if(string[i] == find) {
            string[i] = replace;
        }
    }
}
Reply


Messages In This Thread
/me command - by Hand-Scripter - 02.03.2012, 08:57
Re: /me command - by Twisted_Insane - 02.03.2012, 08:59
Re: /me command - by Hand-Scripter - 02.03.2012, 09:02
Re: /me command - by Twisted_Insane - 02.03.2012, 09:06
Re: /me command - by Hand-Scripter - 02.03.2012, 09:10
Re: /me command - by ShOoBy - 02.03.2012, 09:10
Re: /me command - by Twisted_Insane - 02.03.2012, 09:11
Re: /me command - by Hand-Scripter - 02.03.2012, 09:19
Re: /me command - by ShOoBy - 02.03.2012, 09:21
Re: /me command - by Walsh - 02.03.2012, 12:26

Forum Jump:


Users browsing this thread: 1 Guest(s)