/me command please
#1

i need /me command with sscanf and zcmd
Reply
#2

pawn Код:
CMD:me(playerid, params[])
{
    new Message[128], sendername[MAX_PLAYER_NAME];
    new actiontext[MAX_CHATBUBBLE_LENGTH+1];
    new metext[MAX_CHATBUBBLE_LENGTH+1];
    if(sscanf(params,"s", Message)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /me [text]");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s", Message);
    format(metext,MAX_CHATBUBBLE_LENGTH,"* %s %s", sendername, Message);
    SetPlayerChatBubble(playerid,actiontext,0xFF9900FF,30.0,10000);
    SendClientMessageToAll(0xFFFFFFFF,metext);
    return 1;
}
Oh and btw, next time try to use "search". It's there for a reason.
EDIT: Also post it in Here . Not on this one
Reply
#3

Quote:
Originally Posted by Ken97
Посмотреть сообщение
pawn Код:
CMD:me(playerid, params[])
{
    new Message[128], sendername[MAX_PLAYER_NAME];
    new actiontext[MAX_CHATBUBBLE_LENGTH+1];
    new metext[MAX_CHATBUBBLE_LENGTH+1];
    if(sscanf(params,"s", Message)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /me [text]");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s", Message);
    format(metext,MAX_CHATBUBBLE_LENGTH,"* %s %s", sendername, Message);
    SetPlayerChatBubble(playerid,actiontext,0xFF9900FF,30.0,10000);
    SendClientMessageToAll(0xFFFFFFFF,metext);
    return 1;
}
Oh and btw, next time try to use "search". It's there for a reason.
EDIT: Also post it in Here . Not on this one
That's not the correct command honestly. That just sends a message to all players. I'm sure that James Coral needs a local /me command, which can only be seen by players around a certain range.


pawn Код:
CMD:me(playerid, params[])
{
    new text[100], str[128], pName[MAX_PLAYER_NAME], Float: Pos[3];
    if(sscanf(params,"s[100]", text))
         return SendClientMessage(playerid, -1,"USAGE: /me [action]");

    GetPlayerName(playerid, pName, sizeof pName);
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    format(str, sizeof str, "%s %s", pName, text);
    for(new i = 0; i<MAX_PLAYERS; i++)
        if(IsPlayerInRangeOfPoint(i, 30.0, Pos[0], Pos[1], Pos[2]))
            SendClientMessage(i, -1, str);
    return 1;
}
You'll need to find yourself the /me command color, I have no idea what's the color, sorry.
Reply
#4

Yes, for RP that's the way to do it.
My code is for freeroam or sumthin' kind of approach, my bad
Reply
#5

Thanks to everyone +rep D:
Reply
#6

it gives me sscanf warning
Reply
#7

pawn Код:
COMMAND:me(playerid,params[])
{
    new Msg[128], Message[128], Name[24];

    if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"* Private200 <action>\"");
        else
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(Msg, sizeof(Msg), "* %s: %s", Name, Message);
        SendClientMessageToAll(0xFFFF00AA, Msg);
    }
    return 1;
}
I think this shall work fine . I haven't tested it ..
Reply
#8

Quote:
Originally Posted by Private200
Посмотреть сообщение
pawn Код:
COMMAND:me(playerid,params[])
{
    new Msg[128], Message[128], Name[24];

    if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"* antonio112 <action>\"");
        else
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(Msg, sizeof(Msg), "* %s: %s", Name, Message);
        SendClientMessageToAll(0xFFFF00AA, Msg);
    }
    return 1;
}
I think this shall work fine . I haven't tested it ..
You haven't read any post above yours, have you?
Reply
#9

1.first define the colors

2.then use these includes

Код:
#include <sscanf2>
#include <ZCMD>
3. and then copy then paste this any where you want, you can post it at the last line of the script.

Код:
COMMAND:me(playerid,params[])
{
        new msg[50];
        if(!sscanf(params, "s[50]",msg))
	{
		new mename[MAX_PLAYER_NAME];
		GetPlayerName(playerid,mename,sizeof(mename));
		new string[256];
		format(string,sizeof(string),"** %s %s **",mename,msg);
		SendClientMessageToAll(COLOR_PINK,string);
	}
	else SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /me <rp text>");
        return 1;
}
enjoy.
Reply
#10

Goddamn it, read antonio's post and stop posting answers to thread that already have been solved.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)