How to make a command with an extra parameter?
#8

Don was faster :S nvm read it again

Quote:
Originally Posted by lRaged
Quote:
Originally Posted by Don Correlli
The best way is zcmd + sscanf, there are many examples on the forum - search for them and you'll find them.
Well to be honest I'd rather become familiar with strtok etc. instead of using plugins. But could you figure out the problem for me please?
You could use sscanf 1.0, too (can be found in the wiki -> sscanf)
It was only put into a plugin because there it got extra functions and it is way faster

But if you dont want to use anything new for you use that crap - it's limited from 0 till 99
pawn Код:
if(strcmp("/handsup", cmdtext, true, 8) == 0 && (cmdtext[8] == EOS || cmdtext[8] == ' '))
    {
        if(cmdtext[8] == &#39; ' && '0' <= cmdtext[9] && cmdtext[9] <= '9')
            switch(((cmdtext[10] != EOS) ? (((cmdtext[9] - &#39;0') * 10) + (cmdtext[10] - '0')) : (cmdtext[9] - '0')))
            {
                case 1: return ApplyAnimation(playerid, "ROB_BANK", "SHP_HandsUp_Scr", 4.1, 0, 0, 0, 1, 1);
                case 2: return ApplyAnimation(playerid, "PED", "handsup", 4.1, 0, 0, 0, 1, 1);
            }
        return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /handsup [1-2]");
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)