Posts: 410
Threads: 88
Joined: Oct 2008
Reputation:
0
As the title says, I need some help with saving player weapons into a file (I'm using Dini).
I can only save player's weapon if he equips it, and its just one weapon.
Posts: 410
Threads: 88
Joined: Oct 2008
Reputation:
0
Thats not what I need, as I said, I Can save one weapon at least (if the player equips it)
I already know what you just gave me.
Posts: 410
Threads: 88
Joined: Oct 2008
Reputation:
0
I need help with SAVING them, not getting them
Posts: 6,129
Threads: 36
Joined: Jan 2009
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new
playerFile[39],
weapons[13][2],
playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(playerFile, sizeof(playerFile), "Accounts/%s.ini", playerName);
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
dini_IntSet(playerFile, "weaponSlot0", weapons[0][0]);
dini_IntSet(playerFile, "weaponSlot1", weapons[1][0]);
dini_IntSet(playerFile, "weaponSlot2", weapons[2][0]);
dini_IntSet(playerFile, "weaponSlot3", weapons[3][0]);
dini_IntSet(playerFile, "weaponSlot4", weapons[4][0]);
dini_IntSet(playerFile, "weaponSlot5", weapons[5][0]);
dini_IntSet(playerFile, "weaponSlot6", weapons[6][0]);
dini_IntSet(playerFile, "weaponSlot7", weapons[7][0]);
dini_IntSet(playerFile, "weaponSlot8", weapons[8][0]);
dini_IntSet(playerFile, "weaponSlot9", weapons[9][0]);
dini_IntSet(playerFile, "weaponSlot10", weapons[10][0]);
dini_IntSet(playerFile, "weaponSlot11", weapons[11][0]);
dini_IntSet(playerFile, "weaponSlot12", weapons[12][0]);
return 1;
}
Untested.
Posts: 440
Threads: 14
Joined: Sep 2009
Reputation:
0
It would work, just change format(playerFile, sizeof(playerFile), "Accounts/%s.ini", playerName); to your account path.
Posts: 410
Threads: 88
Joined: Oct 2008
Reputation:
0
I did, but it saves "0" in all values, even if I have some weapon.