PDA

View Full Version : [zcmd] - Space in commands possible?


Deal-or-die
03/05/2012, 02:00 AM
Hello,
Is it possible to have a space in a command when using 'zcmd (http://forum.sa-mp.com/showthread.php?t=91354)'?

Example:
/create House
/create Business

JaKe Elite
03/05/2012, 02:17 AM
Nope its not possible
use strcmp to make a command like this


USAGE: /create [House/Business]

RicaNiel
03/05/2012, 02:26 AM
Nope its not possible
use strcmp to make a command like this


USAGE: /create [House/Business]


are you sure?
use strcmp its possible

JaKe Elite
03/05/2012, 02:27 AM
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

Deal-or-die
03/05/2012, 02:31 AM
Mind for an example of just the command line?

ReneG
03/05/2012, 02:35 AM
Yes, you use strcmp in zcmd. Keep in mind strcmp is not a command processor, it's a string comparer.
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;
}

Deal-or-die
03/05/2012, 02:37 AM
Cheers mate, Greatly appreciated.