IF to SWITCH
#8

I will recommend you to rewrite the command not using switch because it don't need to.
Код:
YCMD:set(playerid, params[], help)
{
	if(playerVariables[playerid][pAdmin] <= 4) return AdminOnly(playerid, 5);
	new option[32], id, value;
	if(sscanf(params, "sud", option, id, value))
	{
		Syntax(playerid, "/set <option> <playerid> <value>");
		SCM(playerid, COLOR_SERVER, "Options: {FFFFFF}money, level");
		return 1;
	}
	new bool:foundOption = false;
	if(!strcmp(option, "money", true, 5))
	{
		if(id == INVALID_PLAYER_ID) return Syntax(playerid, "/set money <playerid> <value>");
		SetMoney(id, value);
		foundOption = true;
	}
	else if(!strcmp(option, "level", true))
	{
		if(id == INVALID_PLAYER_ID) return Syntax(playerid, "/set level <playerid> <value>");
		UpdateVar(playerid, "Level", value);
		foundOption = true;
	}
	if(!foundOption)
		SCM(playerid, COLOR_SERVER, "Options: {FFFFFF}money, level");
	return 1;
}
Reply


Messages In This Thread
IF to SWITCH - by Hazliu - 27.04.2018, 12:19
Re: IF to SWITCH - by CodeStyle175 - 27.04.2018, 12:23
Re: IF to SWITCH - by jasperschellekens - 27.04.2018, 12:26
Re: IF to SWITCH - by CodeStyle175 - 27.04.2018, 12:30
Re: IF to SWITCH - by jasperschellekens - 27.04.2018, 12:31
Re: IF to SWITCH - by CodeStyle175 - 27.04.2018, 12:34
Re: IF to SWITCH - by jasperschellekens - 27.04.2018, 12:36
Re: IF to SWITCH - by FnZ - 27.04.2018, 12:49
Re: IF to SWITCH - by Dutheil - 27.04.2018, 13:34
Re: IF to SWITCH - by Hazliu - 27.04.2018, 14:08

Forum Jump:


Users browsing this thread: 2 Guest(s)