19.04.2018, 20:02
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:
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. )
It completely ignores this one:
How do I solve this problem?
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; }
My issue is, that it only checks the first sscanf line. ( this one. )
Код:
if(sscanf(params, "s[30]", option)) {
Код:
if(sscanf(params, "s[30]ui", option, targetid, level))