14.05.2013, 16:35
The code below is supposed to look for inline HEX colors inside of a string. In my game-mode, there's "line splitting" so if the size of the string is longer than 144 characters, it will split to a new line. While that works fine, the problem is that if HEX colors were used in the string, they won't carry over to the secondary line. That's what this code was designed to do.
The problem is that it gets into an infinite loop where iStartPosition and iEndPosition remain the same- though that's not what the code should be allowing it to do.
Let's take this string for example:
Obviously iStartPosition is 13 and iEndPosition is 20. However, with this string, it continues to loop where iStartPosition remains 13 and iEndPosition remains 20.
Any ideas, folks?
The problem is that it gets into an infinite loop where iStartPosition and iEndPosition remain the same- though that's not what the code should be allowing it to do.
pawn Код:
new
szLastHexColor[10],
iStartPosition,
iEndPosition;
while(strfind(string, "{", false, iEndPosition) != -1)
{
iStartPosition = strfind(string, "{", false);
iEndPosition = strfind(string, "}", false);
strmid(szLastHexColor, string, iStartPosition, iEndPosition+1);
}
pawn Код:
"[ASSISTANCE] {FFFFFF}- %s(%d) is requesting assistance. Type {FFFF00}/takeas %d {FFFFFF}to take this request!"
Any ideas, folks?