SA-MP Forums Archive
[CODE] save weapons on dini - help please - 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)
+--- Thread: [CODE] save weapons on dini - help please (/showthread.php?tid=331959)



[CODE] save weapons on dini - help please - squomp - 06.04.2012

Im trying to save the weapons a player has when they disconnect -
//weapons save///////////////////////////////////////
new weapons[13][2];
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
dini_IntSet(file, "weapons", weapons[i][0]);
}
/////////////////////////////////////////////////////////

I get no errors with this code but it dosnt work,

I also want to be able to load the weapons on player login, someone please help.


Re: [CODE] save weapons on dini - help please - ViniBorn - 06.04.2012

You formated 'file' ?


Re: [CODE] save weapons on dini - help please - Amit_B - 06.04.2012

@Viniborn I guess he is. Anyway that's not the problem.

DINI supports setting a single int value to the file, I mean, for example, setting "Admin=2" is possible but setting a few values such as "Weapons=0,22,28" - you can't do that (well, you can with some advanced shits, but that's could be hard to explain right now).

What I suggest you is to use different key for every value, for example "Weapon%d" instead of "Weapons" which the %d is the weapon slot (defined by i in the for loop).
Then you'll be able to write a few values into a few keys.


Re: [CODE] save weapons on dini - help please - squomp - 07.04.2012

is there another way to save data apart from dini?


Re: [CODE] save weapons on dini - help please - Rob_Maate - 07.04.2012

dINI
y_ini
fread
MySQL
SQLite
Plaintext
HTTP

Pick one?


Re: [CODE] save weapons on dini - help please - Reklez - 07.04.2012

if i were you i will choose Y_INI, MYSQL and SQLite than dini


Re: [CODE] save weapons on dini - help please - squomp - 07.04.2012

can I get an example of how I would save a players data on disconnect to Y_INI, or MYSQL? I just want to see how it works.


Re: [CODE] save weapons on dini - help please - Rob_Maate - 07.04.2012

Use SQLite.


Re: [CODE] save weapons on dini - help please - Harish - 07.04.2012

you are using dini

so save like this
pawn Код:
dini_IntSet(file, "weaponslot1", weapons[0][0]);
dini_IntSet(file, "weaponslot1_ammo", weapons[0][1]);
dini_IntSet(file, "weaponslot2", weapons[1][0]);
dini_IntSet(file, "weaponslot2_ammo", weapons[1][1]);
dini_IntSet(file, "weaponslot3", weapons[2][0]);
dini_IntSet(file, "weaponslot3_ammo", weapons[2][1]);
dini_IntSet(file, "weaponslot4", weapons[3][0]);
dini_IntSet(file, "weaponslot4_ammo", weapons[3][1]);
with this you can load it easily