SA-MP Forums Archive
[zcmd] - Space in commands possible? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [zcmd] - Space in commands possible? (/showthread.php?tid=339302)



[zcmd] - Space in commands possible? - Deal-or-die - 03.05.2012

Hello,
Is it possible to have a space in a command when using 'zcmd'?

Example:
/create House
/create Business


Re: [zcmd] - Space in commands possible? - JaKe Elite - 03.05.2012

Nope its not possible
use strcmp to make a command like this

Код:
USAGE: /create [House/Business]



Re: [zcmd] - Space in commands possible? - RicaNiel - 03.05.2012

Quote:
Originally Posted by Romel
Посмотреть сообщение
Nope its not possible
use strcmp to make a command like this

Код:
USAGE: /create [House/Business]
are you sure?
use strcmp its possible


Re: [zcmd] - Space in commands possible? - JaKe Elite - 03.05.2012

By mistake i mean i'm sure by using sscanf and strcmp with zcmd i didn't done this before so sorry if i give wrong hint


Re: [zcmd] - Space in commands possible? - Deal-or-die - 03.05.2012

Mind for an example of just the command line?


Re: [zcmd] - Space in commands possible? - ReneG - 03.05.2012

Yes, you use strcmp in zcmd. Keep in mind strcmp is not a command processor, it's a string comparer.
pawn Код:
CMD:create(playerid, params[])
{
    new option[20];
    if(isnull(params)) // if they didn't type something after /create
    {
        // tell em how to use it.
        return SendClientMessage(playerid, -1, "USAGE: /create [house/business]");
    }
    if(!strcmp(option, "house", true))
    {
        // if they typed house
        // code goes here
        return 1;
    }
    if(!strcmp(option, "business", true))
    {
        // if they typed business
        // code here.
        return 1;
    }
    return 1;
}



Re: [zcmd] - Space in commands possible? - Deal-or-die - 03.05.2012

Cheers mate, Greatly appreciated.