question about strcmp and strtok
#1

Hi, i just have a question to ask you guys:

I wrote a simple command that send the playerid's text to everyone.
So the text parameter is stocked is the text variable.
But if i delete the 4 in the strcmp, the command will not work.

pawn Код:
if(strcmp("/all", cmdtext, true, 4) == 0) // Removing the 4 make the command to not work.
        {
            new text[124];
            new str[124];
            new playername[MAX_PLAYER_NAME];
            new idx;
            text = strtok(cmdtext[4], idx); // 4 is here too.
            if (strlen(text) == 0)
            {
                SendClientMessage(playerid, 0x41A5F5FF, "[USE] /all <text>");
                return 1;
            }
            else
            {
                GetPlayerName(playerid, playername, sizeof(playername));
                RPName(playername);
                format(str, sizeof(str), "[ALL] {00CED1}%s {FAF427}say: %s", playername, text);
                SendClientMessageToAll(COLOR_YELLOW, str);
                return 1;
            }  
        }
And i wanted to know why it does'nt work without the 4.

Thanks
Reply


Messages In This Thread
question about strcmp and strtok - by Garwan50 - 20.10.2013, 14:27
Re: question about strcmp and strtok - by PT - 20.10.2013, 14:33
Re : question about strcmp and strtok - by Garwan50 - 20.10.2013, 14:45
Re: question about strcmp and strtok - by Konstantinos - 20.10.2013, 14:50
Re : question about strcmp and strtok - by Garwan50 - 20.10.2013, 14:53
Re: question about strcmp and strtok - by Konstantinos - 20.10.2013, 14:55
AW: question about strcmp and strtok - by Nero_3D - 20.10.2013, 15:04
Re : question about strcmp and strtok - by Garwan50 - 20.10.2013, 16:07
AW: question about strcmp and strtok - by Nero_3D - 20.10.2013, 16:10

Forum Jump:


Users browsing this thread: 1 Guest(s)