03.03.2009, 10:02
Ok well before I pull my hair out... what is going wrong?
no, im not getting things compiling wrong, but the thing is the variable "result" is not returning anything... I feel like an idiot for getting to the point where I had to post this, but it saves me from ripping out more hair. Thanks for the help
EDIT: Alright, im an idiot... there is no need for the tmp = strtok(cmdtext, idx); at the beginning
pawn Код:
if(strcmp(cmd, "/ac", true) == 0)
{
tmp = strtok(cmdtext, idx);
new name[maxplayername];
GetPlayerName(playerid, name, sizeof(name));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
PlayerMessage(playerid, yellow1, "/ac [admin chat]");
return 1;
}
format(str, sizeof(str), "%s says: %s", name, result);
if(Player[playerid][admin] > 0)
{
PlayerMessage(playerid, ppurple3, str);
}
return 1;
}
EDIT: Alright, im an idiot... there is no need for the tmp = strtok(cmdtext, idx); at the beginning