[CODE] save weapons on dini - help please
#1

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

You formated 'file' ?
Reply
#3

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

is there another way to save data apart from dini?
Reply
#5

dINI
y_ini
fread
MySQL
SQLite
Plaintext
HTTP

Pick one?
Reply
#6

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

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

Use SQLite.
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)