IF to SWITCH
#1

Sooooo... i can make this command:
Код:
YCMD:set(playerid, params[], help)
{
	if(playerVariables[playerid][pAdmin] <= 4) return AdminOnly(playerid, 5);
	if (isnull(params))
	{
		Syntax(playerid, "/set <option> <playerid> <value>");
		SCM(playerid, COLOR_SERVER, "Options: {FFFFFF}money, level");
		return 1;
	}
	new toplayerid, value;
	if (!strcmp(params, "money", true, 5))
	{
		if(sscanf(params[5], "ui", toplayerid, value)) return Syntax(playerid, "/set money <playerid> <value>");
		if(toplayerid == INVALID_PLAYER_ID) return Syntax(playerid, "/set money <playerid> <value>");
		SetMoney(toplayerid, value);
		return 1;
	}
	if (!strcmp(params, "level", true, 5))
	{
		if(sscanf(params[5], "ui", toplayerid, value)) return Syntax(playerid, "/set level <playerid> <value>");
		if(toplayerid == INVALID_PLAYER_ID) return Syntax(playerid, "/set level <playerid> <value>");
		UpdateVar(playerid, "Level", value);
		return 1;
	}
	return 1;
}
with SWITCH?
I tried something like switch(params) { case money:{} } but i'm getting error.
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: 1 Guest(s)