sscanf question.
#5

Neither of those will work properly; the first will not work for parts of a player's name, and the second will not return true for "/spec off" (id will just be set to INVALID_PLAYER_ID).

pawn Код:
if(!isnull(params) && strcmp(params, "off", true) == 0) {
    //exit spec
    return 1;
}

new id;
if(sscanf(params, "u", id) || id == INVALID_PLAYER_ID) {
    // invalid player
    return 1;
}

// spec the player
You might want to consider just using just "/spec" to exit spectate mode, since someone might have the name "off".
Reply


Messages In This Thread
sscanf question. - by Giacomand - 28.11.2009, 01:03
Re: sscanf question. - by yezizhu - 28.11.2009, 01:10
Re: sscanf question. - by Giacomand - 28.11.2009, 03:04
Re: sscanf question. - by yezizhu - 28.11.2009, 04:04
Re: sscanf question. - by Dabombber - 28.11.2009, 05:52

Forum Jump:


Users browsing this thread: 1 Guest(s)