Command gone rong
#1

Ok i made two commands, And one is set to say: TXS Usage: /requestland [LS/LV/SF]
And the others supposed to say: %s to LS ATC, Requesting runway clear.
But the first one says: TXS Usage: /requestland [LS/LV/SF] like its supposed to.
But the second one says: TXS Usage: /requestland [LS/LV/SF] when it shouldnt
Why is this?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "TXS Usage: /requestland[LS/LV/SF]");
        return 1;
    }
    if (strcmp("/mycommand1", cmdtext, true, 10) == 0)
    {
      SendClientMessageToAll(COLOR_GREY, "to LS ATC, is requesting landing.");
        return 1;
    }
    return 0;
}
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)//<-------->count /mycommand
    {
        SendClientMessage(playerid, COLOR_GREY, "TXS Usage: /requestland[LS/LV/SF]");
        return 1;
    }
    if (strcmp("/mycommand1", cmdtext, true, 10) == 0)//<-------->count /mycommand1 then look at 10
    {
      SendClientMessageToAll(COLOR_GREY, "to LS ATC, is requesting landing.");
        return 1;
    }
    return 0;
}
Reply
#3

I dnt understand
Reply
#4

1 2 3 4 5 6 7 8 9 10
/ m y c o m m a n d

1 2 3 4 5 6 7 8 9 10 11
/ m y c o m m a n d 1

its 10 in each command so you still using first command.
Reply
#5

ahh
Reply
#6

Advice was helpless, Still does it, Even does it for commands that dont exist, Whats the problem.
It dosent do it for commands that dont use SendClientMessage,
Just ones that have the code
pawn Код:
SendClientMessage
in
Reply
#7

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true) == 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "TXS Usage: /requestland[LS/LV/SF]");
        return 1;
    }
    if (strcmp("/mycommand1", cmdtext, true) == 0)
    {
        SendClientMessageToAll(COLOR_GREY, "to LS ATC, is requesting landing.");
        return 1;
    }
    return 0;
}
Reply
#8

The point is the commands are so similar. You should have renamed that second command to anything

pawn Код:
if (strcmp("/second", cmdtext, true, 7) == 0)
then changed the number accordingly this you did not do. You will find it works.
Reply
#9

dcmd for the win
Reply
#10

the commands need to be the same,
There for diffrent islands and the others a usage
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)