30.11.2015, 10:56
Hello guys,
So I have a tendency to create commands that work like sub-commands, I'm not one to make loads of commands to do one option at a time. I'd rather use parameters to specify what they would like to do when using that command.
However I have came across a problem I keep thinking I'm close to fixing, then finding it doesn't work.
I have an /accept command. Now the /accept works for multiple parameters as shown here USAGE: /accept (hire, interview, gag, tie, ticket) etc.
However, administrators get another parameter they can accept, in which is 'namechange'. When a player uses /changename in my server, it sends a request to admins online to accept it, now that's not the problem, I know what I am doing, it's just the parameters that I have no idea what I'm doing with. Let me show you.
When typing /accept namechange it does display the USAGE: /accept namechange [id]. However once typing the ID in after. Nothing happens, it should proceed onto the code thats below (I haven't shown it here). Can anyone assist?
So I have a tendency to create commands that work like sub-commands, I'm not one to make loads of commands to do one option at a time. I'd rather use parameters to specify what they would like to do when using that command.
However I have came across a problem I keep thinking I'm close to fixing, then finding it doesn't work.
I have an /accept command. Now the /accept works for multiple parameters as shown here USAGE: /accept (hire, interview, gag, tie, ticket) etc.
However, administrators get another parameter they can accept, in which is 'namechange'. When a player uses /changename in my server, it sends a request to admins online to accept it, now that's not the problem, I know what I am doing, it's just the parameters that I have no idea what I'm doing with. Let me show you.
PHP код:
CMD:accept(playerid, params[])
{
new choice[32];
if(sscanf(params, "s[32]", choice)) return SCM(playerid, COLOR_GREY, "USAGE: /accept (hire, interview, gag, tie, ticket)");
if(!strcmp(choice, "namechange", true))
{
if(PlayerInfo[playerid][AdminLevel] < 1) return AuthorMsg(playerid);
new id;
if(sscanf(params, "i", id)) return SCM(playerid, COLOR_GREY, "USAGE: /accept namechange [id]");
if(id == INVALID_PLAYER_ID) return SendClientMessageF(playerid, COLOR_GREY, "Invalid Player ID.");
if(RequestNameChange[id] != 1) return SCM(playerid, COLOR_GREY, "That player is not requesting a name change.");