Sub-commands Problem
#1

I've been trying to implement sub commands inside a command, I've tried using strcmp and strfind for it but they dont seem to work.
I'm using I-ZCMD, sscanf.

Код:
new cmd[128];
if(sscanf(params, "s[128]", cmd)) return SFM(playerid, COLOR_GREY, "[USAGE] vtrunk (option)"), SFM(playerid, COLOR_GREY, "[OPTIONS] view take put");
if(strfind(cmd, "view") == 0)
{
	new count = 0;
	SFM(playerid, COLOR_GREY, "Trunk Items");
	for(new x = 0; x < 5; x++)
	{
		//getitems pass = count++ and print else nothing
	}
	if(count == 0) SFM(playerid, COLOR_YELLOWGREEN, "No items found in trunk.");
	count = 0;
	SFM(playerid, COLOR_GREY, "Trunk Weapons");
	for(new x = 0; x < 5; x++)
	{
		//getweapons pass = count++ and print else nothing
	}
	if(count == 0) SFM(playerid, COLOR_YELLOWGREEN, "No weapons found in trunk.");
}
else if(strfind(cmd, "take") == 0)
{
	new cmdex[128];
	if(sscanf(cmd, "s[128]", cmdex)) return SFM(playerid, COLOR_GREY, "[USAGE] vtrunk take (weapon/item)");
	if(strfind(cmdex, "weapon") == 0)
	{
		SFM(playerid, COLOR_GREY, "Under Construction!");
	}
	else if(strfind(cmdex, "item") == 0)
	{
		//under construncton
	}
	else
	{
		SFM(playerid, COLOR_GREY, "[USAGE] vtrunk take (weapon/item)");
	}
}
else if(strfind(cmd, "put") == 0)
{
	new cmdex[128];
	if(sscanf(cmd, "s[128]", cmdex)) return SFM(playerid, COLOR_GREY, "[USAGE] vtrunk put (weapon/item)");
	if(strfind(cmdex, "weapon") == 0)
	{
		SFM(playerid, COLOR_GREY, "Under Construction!");
	}
	else if(strfind(cmdex, "item") == 0)
	{
		//under construncton
	}
	else
	{
		SFM(playerid, COLOR_GREY, "[USAGE] vtrunk take (weapon/item)");
	}
}
else
{
	return 1;
}
Error:
Код:
[03:05:36] [USAGE] vtrunk take (weapon/item)

[03:05:45] [USAGE] vtrunk put (weapon/item)
Commands:
Код:
/vtrunk take (and now anything that falls under this)
/vtrunk put (and now anything that falls under this)
Reply


Messages In This Thread
Sub-commands Problem - by MafiaOink - 17.03.2018, 22:14
Re: Sub-commands Problem - by m1kas - 17.03.2018, 22:42
Re: Sub-commands Problem - by MafiaOink - 18.03.2018, 07:11
Re: Sub-commands Problem - by m1kas - 18.03.2018, 14:05

Forum Jump:


Users browsing this thread: 1 Guest(s)