Formatting strings breaks code:
#1

I've have this code which is to get player faction information, however when this code is not commented out the statics command stops working and doesn't execute:
pawn Код:
if(PlayerInfo[targetid][pFaction] >= 0) {
        format(employer, sizeof(employer), "%s", GroupInfo[pInfo[targetid][pFaction]][fGroupName]);
        format(rank, sizeof(rank), "%s", GroupRankInfo[pInfo[targetid][pFaction]][pInfo[targetid][pRank]]);
        format(division, sizeof(division), "%s", GroupDivisonInfo[pInfo[targetid][pFaction]][pInfo[targetid][pDivision]]);
    }
    else {
        employer = "None"; division = "None"; rank = "N/A";
    }
I debugged it up to this part, when removed the command works when in the command stops working are sometimes returns it as an unknown command - But not always.

EDIT: Fixed, the value was -1 which somehow made the code break.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)