Help: Making a /resparay
#1

I need help making a /respray command for mehaincs.

Here is what the CMD will be: /spray [playerid/PartOfName][Cost] [Color1] [Color2]

But how do I define each of the parts... like:
pawn Код:
tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /spray [playerid/PartOfName] [Cost] [Color1] [Color2]");
                return 1;
            }
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            color1 = ????  
            color2= ????
As you can see... I can define two things (the money and the player ID), but how would I continue to define Color1 and Color2?

Please & Thanks!
Reply
#2

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
I need help making a /respray command for mehaincs.

Here is what the CMD will be: /spray [playerid/PartOfName][Cost] [Color1] [Color2]

But how do I define each of the parts... like:
pawn Код:
tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /spray [playerid/PartOfName] [Cost] [Color1] [Color2]");
                return 1;
            }
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            color1 = ????  
            color2= ????
As you can see... I can define two things (the money and the player ID), but how would I continue to define Color1 and Color2?

Please & Thanks!
pretty simple
PHP код:
        new money strval(tmp);
        
tmp strtok(cmdtextidx);
        new 
color1 strval(tmp);
        
tmp strtok(cmdtextidx);
        new 
color2strval(tmp); 
^^

but why don 't you use sscanf it's faster , shorter and easyier
and a commandprocessor but it is also possible to use it with strcmp commands
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)