Chat & Another Command Interfering
#2

Quote:
Originally Posted by [HIR]AlbanianSoilder
Посмотреть сообщение
I have two commands, one is a chat command and the other is just a normal command (Not chat).

The chat command is /t
and the command is /top

When i type /t and my message, Example,

[TEAM-CHAT] PlayerName: test

it works but when i do the command /top this happens,

[TEAM-CHAT] PlayerName: op

It basically just thinks when i type /top the first T is refering to the chat command. and it does /t and it types out "op"

Can you please help me out! Thanks! The commands as usual:

pawn Код:
if (strcmp("/t", cmdtext, true, 2) == 0)
    {
        new playername[24];
        GetPlayerName(playerid, playername, 24);
        if(strlen(cmdtext) <= 2)
        {
            SendClientMessage(playerid, COLOR_BLUE, "USAGE: /t (Text)");
            return 1;
        }
        new output[255];
        strmid(output,cmdtext,2,strlen(cmdtext));
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            if(IsPlayerConnected(i))
            {
                format(string, sizeof(string), "[TEAM-CHAT] %s: %s", playername, output);
                SendClientMessage(i, COLOR_BLUE, string);
            }
        }
        return 1;
    }
pawn Код:
// Some parts of command removed. but weren't important.
if (strcmp("/top", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, "You have placed it on the top.");
    return 1;

}
I suggest you use zcmd, or dcmd..
ZCMD Example...
pawn Код:
command(top,playerid,params[])
{
    SendClientMessage(playerid,COLOR_LIGHTRED,"You have placed it on the top.");
}
But.. your problem is..
pawn Код:
if (strcmp("/top", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, "You have placed it on the top.");
    return 1;

}
It should be..
pawn Код:
if (strcmp("/top", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid,COLOR, "You have placed it on the top.");
    return 1;

}
Reply


Messages In This Thread
Chat & Another Command Interfering - by [HIR]AlbanianSoilder - 27.12.2010, 02:00
Re: Chat & Another Command Interfering - by 1337connor - 27.12.2010, 02:12
Re: Chat & Another Command Interfering - by [HIR]AlbanianSoilder - 27.12.2010, 02:14
Re: Chat & Another Command Interfering - by 1337connor - 27.12.2010, 02:15
Re: Chat & Another Command Interfering - by Steven82 - 27.12.2010, 02:21
Re: Chat & Another Command Interfering - by [HIR]AlbanianSoilder - 27.12.2010, 03:46
Re: Chat & Another Command Interfering - by Mean - 27.12.2010, 10:10

Forum Jump:


Users browsing this thread: 2 Guest(s)