problem.
#1

Hello, i'm trying to create a "Backpack System",everything works fine except when someone buy a backpack it just replace in the same .ini for example it only create one .ini file it doesn't want to make 1.2.3.etc, what's the problem? here's my codes

Код:
enum pBagIn
{
pbWeapon1,
pbAmmo1
};

new BagInfo[MAX_BAGS2][pBagIn];
Код:
public Createbags(idx, name[], value[]){
new string[128];
format(string, 128, "WeaponID");
INI_Int(string, BagInfo[idx][pbWeapon1]);
format(string, 128, "Ammo");
INI_Int(string, BagInfo[idx][pbAmmo1]);
return 1;
}
Код:
public LoaddataBags(idx){
new housefile[64];
format(housefile, 64, DATA_BAG, idx);
new INI:File = INI_Open(housefile);
INI_SetTag(File,"Informacion");
format(housefile,64, "WeaponID");
INI_WriteInt(File,housefile, BagInfo[idx][pbWeapon1]);
format(housefile, 64, "Ammo");
INI_WriteInt(File,housefile, BagInfo[idx][pbAmmo1]);
INI_Close(File);
return 1;
}
Edit:
and here's where the player's buy the backpack
Код:
  	new idx = 0;
 	while(idx < MAX_BAGS2)
	{
 		if(PlayerInfo[playerid][pBackPack] == 0)
   		{
			Buy(playerid, -1000);
			AttachObjectCorrectly(playerid, 3026);
			PlayerInfo[playerid][pBackPack] = 1;
			SendInfoMessage(playerid, 2,"0", "You have Bought a Bag For $1000!");
			LoaddataBags(idx);
  			idx = MAX_BAGS2;
    		idx++;
		}
	}
and tried this too..
Код:
for(new idx=0; idx<MAX_BAGS2; idx++)
is there something wrong with my codes?, if yes please explain
Reply
#2

bump.
Reply
#3

do you guys don't know solution or you don't understand what i'm saying or what :/
Reply
#4

You have fucked up the indentation, secondally, I can't figure out what you want!
Reply
#5

when someone purchase a bag, it should create a bag for example bag1.ini, if i've bought another one again, it will replace in the same ini file, it only creates one ini file.
i'm sorry i'm trying my best, sorry for my english.
Reply
#6

Bump.
Reply
#7

Because you need to %d it.. To make a multiple backpack files... %d = nummerded!
Reply
#8

DATA_BAG
what's this^
Reply
#9

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
Because you need to %d it.. To make a multiple backpack files... %d = nummerded!
it's %d, and i've wrote the codes again and still saving in the same ini

Код:
#define DATA_BAGS                "Bags/Bag%d.ini"
Reply
#10

Bump.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)