Additional parameters in sscanf, is it possible?
#7

Quote:
Originally Posted by Denying
Посмотреть сообщение
Something like this:

Код:
CMD:accept(playerid, params[])
{
    new choice[32];

    choice = "Teehee";

    sscanf(params, "s[32]", choice);

    if(!strcmp(choice, "namechange", true))
    {
        if(sscanf(params, "s[32]d", choice, id))
            return SCM(playerid, COLOR_GREY, "USAGE: /accept namechange [id]");
    
        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.");
    }
    else return SCM(playerid, COLOR_GREY, "USAGE: /accept (hire, interview, gag, tie, ticket)");
	
    return 1;
}
EDIT: You must give a random value to choice or else this doesn't work completely.
How can you do the
PHP код:
if(sscanf(params"s[32]d"choiceid))
            return 
SCM(playeridCOLOR_GREY"USAGE: /accept namechange [id]"); 
yet you declare the id variable AFTER this sscanf?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)