Problem with this
#1

Код:
new currank[64];
          		if(PlayerInfo[playerid][pDivision] == 1) { currank = "(NA)"; }
          		else if(PlayerInfo[playerid][pDivision] == 2) { currank = "(II)"; }
          		else if(PlayerInfo[playerid][pDivision] == 3) { currank = "(FTO)"; }
          		else if(PlayerInfo[playerid][pDivision] == 4) { currank = "(IA)"; }
          		else if(PlayerInfo[playerid][pDivision] == 5) { currank = "(SWAT)"; }
          		else { currank = "(NA)"; }
				if(PlayerInfo[playerid][pRank] == 10) { format(string, sizeof(string), "** Chief %s %d #%d: %s, over. **", str,currank,PlayerInfo[playerid][pBadgeNumber], result); }
Well this is a simple /radio command for cops etc anyway

Suppose to be

(IA) Because im set to Division 4
**Cheif John Miller (IA) #102 : test, over **

but its saying
**Cheif John Miller 60 #102 : test, over **

why is this ??
Reply
#2

Because you incorrectly formatted the string. You set your 'currank' string to format as an integer (%d), which is incorrect. Strings are to be formatted using the '%s' placeholder. Replace your 'format' statement with this code:

pawn Код:
format(string, sizeof(string), "** Chief %s %s #%d: %s, over. **", str,currank,PlayerInfo[playerid][pBadgeNumber], result);
Reply
#3

currank is a string not an integer. change #d to #s
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)