Sub-commands Problem
#3

Quote:
Originally Posted by m1kas
Посмотреть сообщение
Use something similar to this.

Код:
COMMAND:give(playerid, params[])
{
	new targetid, option[14], param[32], amount;

	if(sscanf(params, "us[14]S()[32]", targetid, option, param))
	{
	    SendClientMessage(playerid, -1, "[Usage]: /give [playerid] [option]");
	    SendClientMessage(playerid, -1, "List of options: Weapon, Cash.");
	    return 1;
	}
	if(!strcmp(option, "weapon", true))
	{
               // Give the weapon the player is currently holding...
	}
	else if(!strcmp(option, "cash", true))
	{
	    if(sscanf(param, "i", amount))
	    {
	        return SendClientMessage(playerid, -1, "[Usage]: /give [playerid] [cash] [amount]");
	    }
            
            // Give the player some cash..

	}
	
	return 1;
}
What about even more parameters? Should I just add a new param?
if(sscanf(params, "us[14]S()[32]S()[32]", targetid, option, param, param2))
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)