02.01.2017, 17:07
Hello, I'm trying to make a command with multiple parameters but, each case is different.
I'm creating the /ochat command and I need to use it with one or two parameters. There are two options: invite and close. The close parameter doesn't have any extra parameter just /ochat close and chat will close. But with invite I need to add a parameter (playerid) and I don't know how I can use first one parameter to detect where IF statement I have to go and then check if the player has entred a second parameter, in case of "invite".
I'm making this:
But don't work.
Anyone can help me? Thanks!
I'm creating the /ochat command and I need to use it with one or two parameters. There are two options: invite and close. The close parameter doesn't have any extra parameter just /ochat close and chat will close. But with invite I need to add a parameter (playerid) and I don't know how I can use first one parameter to detect where IF statement I have to go and then check if the player has entred a second parameter, in case of "invite".
I'm making this:
Код:
CMD:ochat(playerid, params[]) { new param[10]; new id; if(sscanf(params, "s", param)) SendClientMessage(playerid, -1, "Use: /ochat [invite | close]"); if(strmatch(param, "invite")) { if(sscanf(params, "sd", param, id)) return SendClientMessage(playerid, -1, "Use: /ochat invite playerid"); SendClientMessage("OK"); } else if(strmatch(param, "close")) { SendClientMessage("CLOSE"); } else { SendClientMessage(playerid, -1, "Options: invite + playerid or close"); } return 1; }
Anyone can help me? Thanks!