cmdtext's cases can't be read
#1

Hi, I can't access to something like cmdtext[0] in OnPlayerCommandText(), I must use another string to read them.
Код:
	new cmdText[128];
	format(cmdText, 128, "%s", cmdtext);
My question is : Why ?
Reply
#2

hmm what?
u mean u cant use strcmp?
have u got #include <a_samp> at top?
Reply
#3

No I mean using cmdtext[i] (i = 0..127) will "crash" the function (OnPlayerCommandText()), like if it has a return; in it.
Reply
#4

Can you tlel me where ur using cmdtext[i] in?
since i know onPlayerCommandText u should use strcmp(cmdtext, bla bla bla
where your using it in?
Reply
#5

Код:
    // separate command and params
    new command[64];
    new params[128];
    new i = 1, ii = 0;
    while(cmdText[i] != 0 && cmdText[i] != ' ')
    {
        command[ii] = cmdText[i];
        i++;
        ii++;
        if(i > 60)
        {
            return UnknownCommand(playerid, command);
        }
    }
It bug at the while() if I use "cmdtext".
Reply
#6

I cant figure out whats the problem
probably more advanced scripters will see this..
but whats the point of this script actually?
like u wanna replace SERVER:Unknown Command ?
theres a very simple way to replace that >.>
Reply
#7

No it's similar to strtok, I didn't give the whole script.
Reply
#8

You need to show more code, because the problem shouldn't be there.
Reply
#9

No, the problem is here. A print() before the while() works, not after.
Reply
#10

Did you try a print inside the loop?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)