Not saving to ini file (Weapon Data)
#1

Ive made a command to save all the weapons + ammo to a ini file, but all i get in the ini file is this: я

This is my code:

pawn Code:
dcmd_test(playerid,params[])
{
    new Weapons[13][2];
    new Name[MAX_PLAYER_NAME+1];
    new File[128];
    new Slot[128];
       new Slot2[128];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(File, sizeof(File), "DCMain/DCStats/%s.ini", Name);

    for (new i = 0; i < 13; i++)
    {
        GetPlayerWeaponData(i, i, Weapons[i][0], Weapons[i][1]);
       
        format(Slot, sizeof(Slot), "Slot%d", i);
             format(Slot2, sizeof(Slot2), "Slot%dAmmo", i);
        dini_Set(File, Slot, Weapons[i][0]);
        dini_Set(File, Slot2, Weapons[i][1]);
    }
    return 1;
}
Whats wrong?
Please help.

Thnx!
Reply
#2

GetPlayerWeaponData tends to be bugged, use GetPlayerWeapon and GetPlayerAmmo instead.
Reply
#3

I wanna do it like this, coz i need all the weapons.
Any1 got a solution? Thnx
Reply
#4

Quote:
Originally Posted by Robbin237
I wanna do it like this, coz i need all the weapons.
Any1 got a solution? Thnx
Dude, I told you the solution. Don't use GetPlayerWeaponData, it is bugged. There is no other way.
Reply
#5

But then it is not possible to get all the weapons?

EDIT: Im sure it must work, it outputs fine in the console :O
Reply
#6

It is, only changes some things. You now need to get the players weapon for every slot, which are currently ~12. After that you need to get the ammo for all these 12 weapons, if the slot was used.

Edit: Okay, I'll asume the GetPlayerWeaponData works. Then you still didn't use it correctly. You created a loop specially for the weapon slots. Then you are using it for players? That means you save it for 13 players.

Edit2: Also, dini_Set is for strings. Use dini_SetInt.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)