Stupid /find problem
#6

Okay, the problem is with how you're using strtok, you need to use it before the command, so you get the original part of the command, the "/part" without any of the additional parameters, so for that you need to split the information and store it earlier on before the command.

For example:

pawn Код:
public OnPlayerCommandText(playerid, params[])
{
    new
        idx,
        cmd[128] = strtok(cmdtext, idx);
       
    if(strcmp(cmd,"/find",true) == 0)
    // your command
    return 0;
}
Then it should work properly when you type "/find 0", because think about what's happening now.

You type "/find", the if statement checks if cmdtext matches "/find", and it does. Then you type "/find 0", the cmdtext doesn't match "/find", because cmdtext is "/find 0". Now what we're doing is splitting up the information, so that only the first part of the command is compared.

Does this information help? It would be a lot easier if you used a command processor like DCMD, YCMD or ZCMD.
Reply


Messages In This Thread
Stupid /find problem - by bijoyekuza - 19.03.2011, 12:16
Re: Stupid /find problem - by Klutty - 19.03.2011, 12:31
Re: Stupid /find problem - by bijoyekuza - 19.03.2011, 12:57
Re: Stupid /find problem - by JaTochNietDan - 19.03.2011, 13:00
Re: Stupid /find problem - by bijoyekuza - 19.03.2011, 13:28
Re: Stupid /find problem - by JaTochNietDan - 19.03.2011, 13:34
Re: Stupid /find problem - by bijoyekuza - 19.03.2011, 14:29

Forum Jump:


Users browsing this thread: 3 Guest(s)