Not saving to ini file (Weapon Data) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Not saving to ini file (Weapon Data) (
/showthread.php?tid=75475)
Not saving to ini file (Weapon Data) -
Robbin237 - 02.05.2009
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!
Re: Not saving to ini file (Weapon Data) -
HB - 02.05.2009
GetPlayerWeaponData tends to be bugged, use GetPlayerWeapon and GetPlayerAmmo instead.
Re: Not saving to ini file (Weapon Data) -
Robbin237 - 02.05.2009
I wanna do it like this, coz i need all the weapons.
Any1 got a solution? Thnx
Re: Not saving to ini file (Weapon Data) -
HB - 02.05.2009
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.
Re: Not saving to ini file (Weapon Data) -
Robbin237 - 02.05.2009
But then it is not possible to get all the weapons?
EDIT: Im sure it must work, it outputs fine in the console :O
Re: Not saving to ini file (Weapon Data) -
HB - 02.05.2009
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.