sscanf "u" specifier makes problems
#9

Quote:
Originally Posted by Konstantinos
View Post
Just from a fast look, replace all those if/else if statements about PlayerInfo[playerb][pLevel] to a switch and the format can be replaced with an integer variable assignment and after the switch, calling valstr to convert it to string.
Actually, all of the following could be removed:
pawn Code:
//respect
    new respectneed[4];
    if(PlayerInfo[playerb][pLevel] == 1) format(respectneed, sizeof(respectneed), "4");
    else if(PlayerInfo[playerb][pLevel] == 2) format(respectneed, sizeof(respectneed), "8");
    else if(PlayerInfo[playerb][pLevel] == 3) format(respectneed, sizeof(respectneed), "12");
    else if(PlayerInfo[playerb][pLevel] == 4) format(respectneed, sizeof(respectneed), "16");
    else if(PlayerInfo[playerb][pLevel] == 5) format(respectneed, sizeof(respectneed), "20");
    else if(PlayerInfo[playerb][pLevel] == 6) format(respectneed, sizeof(respectneed), "24");
    else if(PlayerInfo[playerb][pLevel] == 7) format(respectneed, sizeof(respectneed), "28");
    else if(PlayerInfo[playerb][pLevel] == 8) format(respectneed, sizeof(respectneed), "32");
    else if(PlayerInfo[playerb][pLevel] == 9) format(respectneed, sizeof(respectneed), "36");
    else if(PlayerInfo[playerb][pLevel] == 10) format(respectneed, sizeof(respectneed), "40");
    else if(PlayerInfo[playerb][pLevel] == 11) format(respectneed, sizeof(respectneed), "44");
    else if(PlayerInfo[playerb][pLevel] == 12) format(respectneed, sizeof(respectneed), "48");
    else if(PlayerInfo[playerb][pLevel] == 13) format(respectneed, sizeof(respectneed), "52");
    else if(PlayerInfo[playerb][pLevel] == 14) format(respectneed, sizeof(respectneed), "56");
    else if(PlayerInfo[playerb][pLevel] == 15) format(respectneed, sizeof(respectneed), "60");
    else if(PlayerInfo[playerb][pLevel] == 16) format(respectneed, sizeof(respectneed), "64");
    else if(PlayerInfo[playerb][pLevel] == 17) format(respectneed, sizeof(respectneed), "68");
    else if(PlayerInfo[playerb][pLevel] == 18) format(respectneed, sizeof(respectneed), "72");
    else if(PlayerInfo[playerb][pLevel] == 19) format(respectneed, sizeof(respectneed), "76");
    else if(PlayerInfo[playerb][pLevel] == 20) format(respectneed, sizeof(respectneed), "80");
    else if(PlayerInfo[playerb][pLevel] == 21) format(respectneed, sizeof(respectneed), "84");
    else if(PlayerInfo[playerb][pLevel] == 22) format(respectneed, sizeof(respectneed), "88");
    else if(PlayerInfo[playerb][pLevel] == 23) format(respectneed, sizeof(respectneed), "92");
    else if(PlayerInfo[playerb][pLevel] == 24) format(respectneed, sizeof(respectneed), "96");
    else if(PlayerInfo[playerb][pLevel] == 25) format(respectneed, sizeof(respectneed), "100");
    else if(PlayerInfo[playerb][pLevel] == 26) format(respectneed, sizeof(respectneed), "104");
    else if(PlayerInfo[playerb][pLevel] == 27) format(respectneed, sizeof(respectneed), "108");
    else if(PlayerInfo[playerb][pLevel] == 28) format(respectneed, sizeof(respectneed), "112");
    else if(PlayerInfo[playerb][pLevel] == 29) format(respectneed, sizeof(respectneed), "116");
    else if(PlayerInfo[playerb][pLevel] == 30) format(respectneed, sizeof(respectneed), "120");
    else if(PlayerInfo[playerb][pLevel] == 31) format(respectneed, sizeof(respectneed), "124");
    else if(PlayerInfo[playerb][pLevel] == 32) format(respectneed, sizeof(respectneed), "128");
    else if(PlayerInfo[playerb][pLevel] == 33) format(respectneed, sizeof(respectneed), "132");
    else if(PlayerInfo[playerb][pLevel] == 34) format(respectneed, sizeof(respectneed), "136");
    else if(PlayerInfo[playerb][pLevel] == 35) format(respectneed, sizeof(respectneed), "140");
    else if(PlayerInfo[playerb][pLevel] == 36) format(respectneed, sizeof(respectneed), "144");
    else if(PlayerInfo[playerb][pLevel] == 37) format(respectneed, sizeof(respectneed), "148");
    else if(PlayerInfo[playerb][pLevel] == 38) format(respectneed, sizeof(respectneed), "152");
    else if(PlayerInfo[playerb][pLevel] == 39) format(respectneed, sizeof(respectneed), "156");
    else if(PlayerInfo[playerb][pLevel] == 40) format(respectneed, sizeof(respectneed), "160");
If you'd rather not remove it though, here is the correct way to do this:
pawn Code:
new respectneed[4];
    format(respectneed, sizeof(respectneed), "%i", PlayerInfo[playerb][pLevel] * 4);




We still need you to post the RPFRN function and line 54528.
Reply


Messages In This Thread
sscanf "u" specifier makes problems - by maximthepain - 21.06.2015, 21:23
Re: sscanf "u" specifier makes problems - by Jimmy0wns - 21.06.2015, 21:29
Re: sscanf "u" specifier makes problems - by maximthepain - 21.06.2015, 21:33
Re: sscanf "u" specifier makes problems - by Crayder - 21.06.2015, 21:41
Re: sscanf "u" specifier makes problems - by maximthepain - 21.06.2015, 21:43
Re: sscanf "u" specifier makes problems - by Crayder - 21.06.2015, 21:48
Re: sscanf "u" specifier makes problems - by maximthepain - 21.06.2015, 21:49
Re: sscanf "u" specifier makes problems - by Konstantinos - 21.06.2015, 22:19
Re: sscanf "u" specifier makes problems - by Crayder - 21.06.2015, 22:28
Re: sscanf "u" specifier makes problems - by maximthepain - 21.06.2015, 22:38

Forum Jump:


Users browsing this thread: 3 Guest(s)