20.10.2013, 14:27
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.
And i wanted to know why it does'nt work without the 4.
Thanks
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;
}
}
Thanks