Save weapons with sscanf
#2

I assume that you mean this

Saving the string:
pawn Код:
//Top
new WepData[2][50];

//Saving
new weapons[13][2];
for (new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    if(!WepData[0][0])
    {
        format(WepData[0], 50, "%d", weapons[i][0]);
        format(WepData[1], 50, "%d", weapons[i][1]);
    }
    else if(WepData[0][0] != 0)
    {
        format(WepData[0], 50, "%d %d", WepData[0], weapons[i][0]);
        format(WepData[1], 50, "%d %d", WepData[1], weapons[i][1]);
    }
}

//WepData[0] prints the weapon IDS
//WepData[1] prints the ammo.
Then you could just split the line using sccanf. I don't see why you would want to, because it uses more cells and it's way easier to just store single digits.
Reply


Messages In This Thread
Save weapons with sscanf - by Urefeu - 29.08.2011, 09:06
Re: Save weapons with sscanf - by [HiC]TheKiller - 29.08.2011, 09:31

Forum Jump:


Users browsing this thread: 1 Guest(s)