05.12.2012, 19:50
Hello, I'm trying to save the player's weapons and ammo in the form of a string, so I can later on decode it.
However, the following code is returning blank strings:
However, the following code is returning blank strings:
Code:
stock SavePlayerGuns(playerid) //So instead of declaring a shitload of variables, I just convert shit into a string. { new iWeapons[13][2], sWeapons[128], sAmmo[128]; //Slot-[Gun/Ammo] for(new i=0; i<13; i++) { GetPlayerWeaponData(playerid, i, iWeapons[i][0], iWeapons[i][1]); } format(sWeapons, sizeof sWeapons, "%i", iWeapons[0][0]); format(sAmmo, sizeof sAmmo, "%i", iWeapons[0][1]); for(new j=0; j<13; j++) { if(j == 0) continue; format(sWeapons, sizeof sWeapons, "%s %i", sWeapons, iWeapons[j][0]); format(sAmmo, sizeof sAmmo, "%s %i", sWeapons, iWeapons[j][1]); } strpack(pInfo[playerid][Weapons], sWeapons); strpack(pInfo[playerid][Ammo], sAmmo); return 1; }