enum ammoSave{
wId0,
wAmmo0,
wId1,
wAmmo1,
wId2,
wAmmo2
}
stock WeaponFile(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"akun/Weapon/%s.ini",playername);
return string;
}
INI_ParseFile(WeaponFile(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
//----------------------Weapon Save--------------------------//
new weapons[13][6];
for(new i=0; i<=12; i++)
{
GetPlayerWeaponData(playerid,i,weapons[i][0],weapons[i][1]);
new INI:filew = INI_Open(WeaponFile(playerid));
INI_SetTag(filew,"WeaponSave");
INI_WriteInt(filew,"Weapon1",weapons[i][0]);
INI_WriteInt(filew,"Ammo1",weapons[i][1]);
INI_WriteInt(filew,"Weapon2",weapons[i][2]);
INI_WriteInt(filew,"Ammo2",weapons[i][3]);
INI_WriteInt(filew,"Weapon3",weapons[i][4]);
INI_WriteInt(filew,"Ammo3",weapons[i][5]);
INI_Close(filew);
}
public LoadUser_weapon(playerid,name[],value[])
{
INI_Int("Weapon1",SenjataInfo[playerid][wId0]);
INI_Int("Ammo1",SenjataInfo[playerid][wAmmo0]);
INI_Int("Weapon2",SenjataInfo[playerid][wId1]);
INI_Int("Ammo2",SenjataInfo[playerid][wAmmo1]);
INI_Int("Weapon3",SenjataInfo[playerid][wId2]);
INI_Int("Ammo3",SenjataInfo[playerid][wAmmo2]);
return 1;
}
GivePlayerWeapon(playerid,SenjataInfo[playerid][wId0],SenjataInfo[playerid][wAmmo0]);
GivePlayerWeapon(playerid,SenjataInfo[playerid][wId1],SenjataInfo[playerid][wAmmo1]);
GivePlayerWeapon(playerid,SenjataInfo[playerid][wId1],SenjataInfo[playerid][wAmmo2]);
INI_SetTag(filew,"WeaponSave");
INI_SetTag(filew,"weapon");
I don't know much about Y_INI, but I think you should make the tag the same as your public tag, so, instead of this:
Код:
INI_SetTag(filew,"WeaponSave"); Код:
INI_SetTag(filew,"weapon"); EDIT before even posting: Nevermind everything, while I was writing up an example for you, I noticed not only the mentioned above is wrong, but everything else from loading to saving. I found this while ******-ing, please use it as an example, try to understand it and make your code from it: http://pastebin.com/6ABeNvDu |