[Help] Saving Player Weapons (Dini)
#1

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.
Reply
#2

https://sampwiki.blast.hk/wiki/GetPlayerWeapon
Reply
#3

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.
Reply
#4

https://sampwiki.blast.hk/wiki/GetPlayerWeaponData


This then?

Or do you need help in DINI?
Reply
#5

I need help with SAVING them, not getting them
Reply
#6

You have to GET them to SAVE them.

How else will the server know what to save? ...

here is tut man

https://sampforum.blast.hk/showthread.php?tid=1647
Reply
#7

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.
Reply
#8

Not working :/
Reply
#9

It would work, just change format(playerFile, sizeof(playerFile), "Accounts/%s.ini", playerName); to your account path.
Reply
#10

I did, but it saves "0" in all values, even if I have some weapon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)