Problem with /me2 command.
#1

REMOVED
Reply
#2

No it doesn't, you just have the same format of message in both /me's...

ME: format(str, sizeof(str), "*** %s (ID:%d) %s", str,playerid,cmdtext[4]);
ME2: format(str, sizeof(str), "*** %s (ID:%d) %s", str,playerid,cmdtext[4]);

If you want to see difference then change ME to:
format(str, sizeof(str), "(ME) %s (ID:%d) %s", str,playerid,cmdtext[4]);

and ME2 to:
format(str, sizeof(str), "(ME2) %s (ID:%d) %s", str,playerid,cmdtext[4]);

Also, what color does the /me2 show in, in-game? is it pink or lime green?
Reply
#3

It happens because string "/me" is prefix of string "/me2". So when you compare first three symbols in "/me" and "/me2" it says that they are equal. It's better for you to use command processors to avoid that.

But if you don't want to use them, a simple fix is to swap the conditions like this:
pawn Код:
if(!strcmp(cmdtext, "/me2", true, 4))
    {
        if(!cmdtext[4])
        {
            SendClientMessage(playerid, COLOR_YELLOW2, "** Usage: /me2 <Message>");
            SendClientMessage(playerid, COLOR_YELLOW2, "*  Displays the specified chat message to all players (in lime).");
            return 1;
        }
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "*** %s (ID:%d) %s", str,playerid,cmdtext[4]);
        SendClientMessageToAll(COLOR_LIME, str);
        return 1;
    }
if(!strcmp(cmdtext, "/me", true, 3))
    {
        if(!cmdtext[3])
        {
            SendClientMessage(playerid, COLOR_YELLOW2, "** Usage: /me <Message>");
            SendClientMessage(playerid, COLOR_YELLOW2, "*  Displays the specified chat message to all players (in pink).");
            return 1;
        }
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "*** %s (ID:%d) %s", str,playerid,cmdtext[4]);
        SendClientMessageToAll(COLOR_PINK, str);
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)