[SOLVED]How can I?
#1

Hello, its me again.
I have this problem. I want to make a command like this: /gang create blabla
/gang info 1
But I cant make spaces in a command when using params.
Now i tried:

pawn Код:
dcmd_gang(playerid,params[])
{
  if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /gang [create | info]");
    new tmp[256], Index; tmp = strtok(params,Index);
    new create[10], info[10];
    create = "create";
     info = "info";

     if(tmp==create) return SendClientMessage(playerid,green,"This worked"); // 3416
    if(tmp==info) return SendClientMessage(playerid,green,"This worked too.");   //3417  
    return 1;
}
and got:
Код:
(3416) error 033: array must be indexed (variable "tmp")
(3417) error 033: array must be indexed (variable "tmp")
Can anyone help me with this?
Would help me alot.

Greetings,
Jeffry
Reply
#2

Im not certain as i have never done it and not at pc but try strtok(params[0], Index);

and 1 for the 2 seperate parts of the command
Reply
#3

Same errors.
Reply
#4

Код:
if(!strcmp(tmp,create,true))
if(!strcmp(tmp,info,true))
Reply
#5

This worked!!

Thank you Jefff.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)