SSCANF parameter issue.
#1

Hello!

Basically, what I am trying to create is a /set command that has a lot of options.

For example, /set adminlevel, /set weather, /set time and so on.

This is what I have so far:

Код:
CMD:set(playerid,params[]) {
	new str[128], option[30], targetid, level;
	if(sscanf(params, "s[30]", option)) {
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: /set [option]");
        return SendClientMessage(playerid, 0xFFFFFFFF, "Available options: adminlevel");
	}
	if(strmatch(params, "adminlevel"))
	{
		if(sscanf(params, "s[30]ui", option, targetid, level))
		format(str,sizeof(str),"You gave %s(%i) admin level %i!",GetName(targetid), targetid, level);
		SendClientMessage(playerid,-1,str);
		PlayerInfo[targetid][pAdmin] = level;
	}
	else return cmd_set(playerid, "");
	return 1;
}
Obviously checking if the player is online, if the player is admin etc is missing but that's not the issue for now.

My issue is, that it only checks the first sscanf line. ( this one. )
Код:
	if(sscanf(params, "s[30]", option)) {
It completely ignores this one:
Код:
		if(sscanf(params, "s[30]ui", option, targetid, level))
How do I solve this problem?
Reply


Messages In This Thread
SSCANF parameter issue. - by Stefhan - 19.04.2018, 20:02
Re: SSCANF parameter issue. - by Hunud - 19.04.2018, 20:05
Re: SSCANF parameter issue. - by Stefhan - 19.04.2018, 20:09
Re: SSCANF parameter issue. - by Hunud - 19.04.2018, 20:17
Re: SSCANF parameter issue. - by AdamsLT - 19.04.2018, 20:27
Re: SSCANF parameter issue. - by Stefhan - 19.04.2018, 20:49
Re: SSCANF parameter issue. - by kovac - 19.04.2018, 21:01
Re: SSCANF parameter issue. - by AdamsLT - 19.04.2018, 21:03
Re: SSCANF parameter issue. - by Stefhan - 19.04.2018, 21:20
Re: SSCANF parameter issue. - by Dayrion - 19.04.2018, 21:23

Forum Jump:


Users browsing this thread: 1 Guest(s)