Additional parameters in sscanf, is it possible?
#8

Quote:
Originally Posted by thefirestate
Посмотреть сообщение
Liam, here's your problem. If you use if(sscanf(params, "s[32]", params)) then check if the params include namechange with if(!strcmp(params, "namechange", true) it will work but once you do if(sscanf(params, "s[32]i", params, id)) the params would become namechange 1 and the only solution is checking by this way : if(!strcmp(params, "namechange", true, 9) where 9 is the string lenght.

PHP код:
CMD:accept(playeridparams[]) 

    if(
sscanf(params"s[32]"params)) return SCM(playeridCOLOR_GREY"USAGE: /accept (hire, interview, gag, tie, ticket)"); 
    if(!
strcmp(params"namechange"true9)) 
    { 
        if(
PlayerInfo[playerid][AdminLevel] < 1) return AuthorMsg(playerid); 
        new 
id
        if(
sscanf(params"s[32]i"paramsid)) return SCM(playeridCOLOR_GREY"USAGE: /accept namechange [id]"); 
        if(
id == INVALID_PLAYER_ID) return SendClientMessageF(playeridCOLOR_GREY"Invalid Player ID."); 
        if(
RequestNameChange[id] != 1) return SCM(playeridCOLOR_GREY"That player is not requesting a name change."); 
I literally just seen this. This solution fixed it, I tried using strlen on Choice, then doing sscanf(params, "s[%d][i]", strlen(choice) etc etc, however that never worked. TheFireState has got it working. Thanks for the assistance guys, and thank you, firestate
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)