Command + a word
#6

Quote:
Originally Posted by mineralo
Посмотреть сообщение
pawn Код:
OnPlayerCommandText(playerid,cmdtext);
{
new cmd[256],idx,tmp[256];
cmd = strtok(cmdtext,idx);
if(!strcmp(cmd,"/help",true))
{
    tmp = strtok(cmdtext,idx);
    if(!strcmp(tmp,"cmds",true))
    {
    //your codes
    }
    return 1;
}
return 1;
}
A lot of waste of memory here! 2 strings with size of 256, when the limit is 128.
Strcmp as a command processor (Basically, it is not even a command processor) and strtok are slow.
You should return 0 at the end of the callback.
Reply


Messages In This Thread
Command + a word - by Zex Tan - 14.01.2013, 08:46
Re: Command + a word - by Konstantinos - 14.01.2013, 09:41
Re: Command + a word - by Zex Tan - 14.01.2013, 12:06
Re: Command + a word - by LarzI - 14.01.2013, 12:13
Re: Command + a word - by mineralo - 14.01.2013, 12:21
Re: Command + a word - by Konstantinos - 14.01.2013, 12:28
Re: Command + a word - by mineralo - 14.01.2013, 12:32
Re: Command + a word - by Zex Tan - 14.01.2013, 12:36

Forum Jump:


Users browsing this thread: 1 Guest(s)