Iffy characters
#1

Hello...

Got an issue right now, can't seem to repair it and mind-boggled as to what would cause such an issue to occur.

pawn Код:
public updateExperienceCounter(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(playerData[playerid][playerLoggedIn])
        {
       
            new minusValue, finalXP[8];
           
            minusValue = 8 - strlen(playerData[playerid][playerXP]); // 300 xp -> 3 length          8 - 3 = 5, need to add 5 zeros.
            format(finalXP, sizeof(finalXP), "%i", playerData[playerid][playerXP]); // so... finalXP would be "300" for now.
           
            while(minusValue > 0)
            {
                if(strlen(finalXP) <= 8)
                {
                    strins(finalXP, "0", 0, sizeof(finalXP)); // add a 0 at the beginning of it...
                    minusValue--; // the minus value needs to be decreased so it doesnt keep adding 0s and continue the loop
                    new message[128];
                    format(message, sizeof(message), "{B7B7B7}[DEBUG] {FFFFFF}playerXP: %i || Current progress: %s", playerData[playerid][playerXP], finalXP);
                    SendClientMessage(playerid, COLOR_WHITE, message);
                }
            }
           
            PlayerTextDrawSetString(playerid, playerExperience[playerid], finalXP);
           
        }
    }
}
If you can't tell, from this I'm adding 0s to the start of the players XP count, 350 -> 00000350, 3500 -> 00003500 etc.

However, in-game this is what I'm receiving.

Код:
[14:48:47] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 1150 || Current progress: 01150
[14:48:47] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 1150 || Current progress: 001150
[14:48:47] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 1150 || Current progress: 0001150
[14:48:47] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 1150 || Current progress: 00001150яx   Њ¬  d

--

[14:48:51] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 350 || Current progress: 0350
[14:48:51] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 350 || Current progress: 00350
[14:48:51] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 350 || Current progress: 000350
[14:48:51] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 350 || Current progress: 0000350
[14:48:51] {B7B7B7}[DEBUG] {FFFFFF}playerXP: 350 || Current progress: 00000350яx   Њ¬  d
So it works perfectly fine up until the final zero, any ideas why?
Reply


Messages In This Thread
Iffy characters - by DanLore - 19.02.2013, 13:27
Re: Iffy characters - by SuperViper - 19.02.2013, 14:32
Re: Iffy characters - by DanLore - 19.02.2013, 15:19

Forum Jump:


Users browsing this thread: 1 Guest(s)