How to Save/Load Weapons && How can I give cars their own ID?
#1

[QUESTION 1]:

Hello,

I got a weapon save system with Dini, I tried everything to
Load it on the next login again, but .. None works..
This is the Save script:

Код:
    new weapons[13][2];
    for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    dini_IntSet(bestand, "weaponSlot0", weapons[0][0]);
    dini_IntSet(bestand, "weaponSlot0Ammo", weapons[0][1]);
    dini_IntSet(bestand, "weaponSlot1", weapons[1][0]);
    dini_IntSet(bestand, "weaponSlot1Ammo", weapons[1][1]);
    dini_IntSet(bestand, "weaponSlot2", weapons[2][0]);
    dini_IntSet(bestand, "weaponSlot2Ammo", weapons[2][1]);
    dini_IntSet(bestand, "weaponSlot3", weapons[3][0]);
    dini_IntSet(bestand, "weaponSlot3Ammo", weapons[3][1]);
    dini_IntSet(bestand, "weaponSlot4", weapons[4][0]);
    dini_IntSet(bestand, "weaponSlot4Ammo", weapons[4][1]);
    dini_IntSet(bestand, "weaponSlot5", weapons[5][0]);
    dini_IntSet(bestand, "weaponSlot5Ammo", weapons[5][1]);
    dini_IntSet(bestand, "weaponSlot6", weapons[6][0]);
    dini_IntSet(bestand, "weaponSlot6Ammo", weapons[6][1]);
    dini_IntSet(bestand, "weaponSlot7", weapons[7][0]);
    dini_IntSet(bestand, "weaponSlot7Ammo", weapons[7][1]);
    dini_IntSet(bestand, "weaponSlot8", weapons[8][0]);
    dini_IntSet(bestand, "weaponSlot8Ammo", weapons[8][1]);
    dini_IntSet(bestand, "weaponSlot9", weapons[9][0]);
    dini_IntSet(bestand, "weaponSlot8Ammo", weapons[9][1]);
    dini_IntSet(bestand, "weaponSlot10", weapons[10][0]);
    dini_IntSet(bestand, "weaponSlot10Ammo", weapons[10][1]);
    dini_IntSet(bestand, "weaponSlot11", weapons[11][0]);
    dini_IntSet(bestand, "weaponSlot11Ammo", weapons[11][1]);
    dini_IntSet(bestand, "weaponSlot12", weapons[12][0]);
    dini_IntSet(bestand, "weaponSlot12Ammo", weapons[12][1]);
HOW can i load this?
__________________________________________________
[QUESTION 2]:

Hello,

I never looked at giving cars their own ID, it will be really
simple for Factions etc. Do you know the simplest way to
make this?

K. Regards,
I. C.
Reply
#2

Quote:
Originally Posted by Ihsan-Cingisiz
Посмотреть сообщение
[QUESTION 1]:

Hello,

I got a weapon save system with Dini, I tried everything to
Load it on the next login again, but .. None works..
This is the Save script:

Код:
    new weapons[13][2];
    for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    dini_IntSet(bestand, "weaponSlot0", weapons[0][0]);
    dini_IntSet(bestand, "weaponSlot0Ammo", weapons[0][1]);
    dini_IntSet(bestand, "weaponSlot1", weapons[1][0]);
    dini_IntSet(bestand, "weaponSlot1Ammo", weapons[1][1]);
    dini_IntSet(bestand, "weaponSlot2", weapons[2][0]);
    dini_IntSet(bestand, "weaponSlot2Ammo", weapons[2][1]);
    dini_IntSet(bestand, "weaponSlot3", weapons[3][0]);
    dini_IntSet(bestand, "weaponSlot3Ammo", weapons[3][1]);
    dini_IntSet(bestand, "weaponSlot4", weapons[4][0]);
    dini_IntSet(bestand, "weaponSlot4Ammo", weapons[4][1]);
    dini_IntSet(bestand, "weaponSlot5", weapons[5][0]);
    dini_IntSet(bestand, "weaponSlot5Ammo", weapons[5][1]);
    dini_IntSet(bestand, "weaponSlot6", weapons[6][0]);
    dini_IntSet(bestand, "weaponSlot6Ammo", weapons[6][1]);
    dini_IntSet(bestand, "weaponSlot7", weapons[7][0]);
    dini_IntSet(bestand, "weaponSlot7Ammo", weapons[7][1]);
    dini_IntSet(bestand, "weaponSlot8", weapons[8][0]);
    dini_IntSet(bestand, "weaponSlot8Ammo", weapons[8][1]);
    dini_IntSet(bestand, "weaponSlot9", weapons[9][0]);
    dini_IntSet(bestand, "weaponSlot8Ammo", weapons[9][1]);
    dini_IntSet(bestand, "weaponSlot10", weapons[10][0]);
    dini_IntSet(bestand, "weaponSlot10Ammo", weapons[10][1]);
    dini_IntSet(bestand, "weaponSlot11", weapons[11][0]);
    dini_IntSet(bestand, "weaponSlot11Ammo", weapons[11][1]);
    dini_IntSet(bestand, "weaponSlot12", weapons[12][0]);
    dini_IntSet(bestand, "weaponSlot12Ammo", weapons[12][1]);
HOW can i load this?
__________________________________________________
[QUESTION 2]:

Hello,

I never looked at giving cars their own ID, it will be really
simple for Factions etc. Do you know the simplest way to
make this?

K. Regards,
I. C.
I made this as my load at spawn:

Код:
	if(gPlayerLogged[playerid] == 1 && HasDied[playerid] == 0)
	{
		new a, a1, b, b1, c, c1, d, d1, e, e1, f, f1, g, g1, h, h1, i, i1, j, j1, k, k1, l, l1, m, m1;
		a = dini_Int(file, "weaponSlot0");
    	a1 = dini_Int(file, "weaponSlot0Ammo");
    	b = dini_Int(file, "weaponSlot1");
    	b1 = dini_Int(file, "weaponSlot1Ammo");
    	c = dini_Int(file, "weaponSlot2");
    	c1 = dini_Int(file, "weaponSlot2Ammo");
    	d = dini_Int(file, "weaponSlot3");
    	d1 = dini_Int(file, "weaponSlot3Ammo");
    	e = dini_Int(file, "weaponSlot4");
    	e1 = dini_Int(file, "weaponSlot4Ammo");
    	f = dini_Int(file, "weaponSlot5");
    	f1 = dini_Int(file, "weaponSlot5Ammo");
    	g = dini_Int(file, "weaponSlot6");
    	g1 = dini_Int(file, "weaponSlot6Ammo");
    	h = dini_Int(file, "weaponSlot7");
    	h1 = dini_Int(file, "weaponSlot7Ammo");
    	i = dini_Int(file, "weaponSlot8");
    	i1 = dini_Int(file, "weaponSlot8Ammo");
    	j = dini_Int(file, "weaponSlot9");
    	j1 = dini_Int(file, "weaponSlot8Ammo");
    	k = dini_Int(file, "weaponSlot10");
    	k1 = dini_Int(file, "weaponSlot10Ammo");
    	l = dini_Int(file, "weaponSlot11");
    	l1 = dini_Int(file, "weaponSlot11Ammo");
    	m = dini_Int(file, "weaponSlot12");
    	m1 = dini_Int(file, "weaponSlot12Ammo");

    	if(a != 0 && a1 != 0) { GivePlayerWeapon(playerid, a, a1); }
    	if(b != 0 && b1 != 0) { GivePlayerWeapon(playerid, b, b1); }
    	if(c != 0 && c1 != 0) { GivePlayerWeapon(playerid, c, c1); }
    	if(d != 0 && d1 != 0) { GivePlayerWeapon(playerid, d, d1); }
    	if(e != 0 && e1 != 0) { GivePlayerWeapon(playerid, e, e1); }
    	if(f != 0 && f1 != 0) { GivePlayerWeapon(playerid, f, f1); }
    	if(g != 0 && g1 != 0) { GivePlayerWeapon(playerid, g, g1); }
    	if(h != 0 && h1 != 0) { GivePlayerWeapon(playerid, h, h1); }
    	if(i != 0 && i1 != 0) { GivePlayerWeapon(playerid, i, i1); }
    	if(j != 0 && j1 != 0) { GivePlayerWeapon(playerid, j, j1); }
    	if(k != 0 && k1 != 0) { GivePlayerWeapon(playerid, k, k1); }
    	if(l != 0 && l1 != 0) { GivePlayerWeapon(playerid, l, l1); }
    	if(m != 0 && m1 != 0) { GivePlayerWeapon(playerid, m, m1); }
	}
It saved and loads the weapon but it seems that it's loading it suddenly.
I mean, i got the weapons, if i scroll to a weaopn it goes to fist mode again.
But they are there, how can i help this problem away?
Reply
#3

Quote:
Originally Posted by Ihsan-Cingisiz
Посмотреть сообщение
I made this as my load at spawn:

Код:
	if(gPlayerLogged[playerid] == 1 && HasDied[playerid] == 0)
	{
		new a, a1, b, b1, c, c1, d, d1, e, e1, f, f1, g, g1, h, h1, i, i1, j, j1, k, k1, l, l1, m, m1;
		a = dini_Int(file, "weaponSlot0");
    	a1 = dini_Int(file, "weaponSlot0Ammo");
    	b = dini_Int(file, "weaponSlot1");
    	b1 = dini_Int(file, "weaponSlot1Ammo");
    	c = dini_Int(file, "weaponSlot2");
    	c1 = dini_Int(file, "weaponSlot2Ammo");
    	d = dini_Int(file, "weaponSlot3");
    	d1 = dini_Int(file, "weaponSlot3Ammo");
    	e = dini_Int(file, "weaponSlot4");
    	e1 = dini_Int(file, "weaponSlot4Ammo");
    	f = dini_Int(file, "weaponSlot5");
    	f1 = dini_Int(file, "weaponSlot5Ammo");
    	g = dini_Int(file, "weaponSlot6");
    	g1 = dini_Int(file, "weaponSlot6Ammo");
    	h = dini_Int(file, "weaponSlot7");
    	h1 = dini_Int(file, "weaponSlot7Ammo");
    	i = dini_Int(file, "weaponSlot8");
    	i1 = dini_Int(file, "weaponSlot8Ammo");
    	j = dini_Int(file, "weaponSlot9");
    	j1 = dini_Int(file, "weaponSlot8Ammo");
    	k = dini_Int(file, "weaponSlot10");
    	k1 = dini_Int(file, "weaponSlot10Ammo");
    	l = dini_Int(file, "weaponSlot11");
    	l1 = dini_Int(file, "weaponSlot11Ammo");
    	m = dini_Int(file, "weaponSlot12");
    	m1 = dini_Int(file, "weaponSlot12Ammo");

    	if(a != 0 && a1 != 0) { GivePlayerWeapon(playerid, a, a1); }
    	if(b != 0 && b1 != 0) { GivePlayerWeapon(playerid, b, b1); }
    	if(c != 0 && c1 != 0) { GivePlayerWeapon(playerid, c, c1); }
    	if(d != 0 && d1 != 0) { GivePlayerWeapon(playerid, d, d1); }
    	if(e != 0 && e1 != 0) { GivePlayerWeapon(playerid, e, e1); }
    	if(f != 0 && f1 != 0) { GivePlayerWeapon(playerid, f, f1); }
    	if(g != 0 && g1 != 0) { GivePlayerWeapon(playerid, g, g1); }
    	if(h != 0 && h1 != 0) { GivePlayerWeapon(playerid, h, h1); }
    	if(i != 0 && i1 != 0) { GivePlayerWeapon(playerid, i, i1); }
    	if(j != 0 && j1 != 0) { GivePlayerWeapon(playerid, j, j1); }
    	if(k != 0 && k1 != 0) { GivePlayerWeapon(playerid, k, k1); }
    	if(l != 0 && l1 != 0) { GivePlayerWeapon(playerid, l, l1); }
    	if(m != 0 && m1 != 0) { GivePlayerWeapon(playerid, m, m1); }
	}
It saved and loads the weapon but it seems that it's loading it suddenly.
I mean, i got the weapons, if i scroll to a weaopn it goes to fist mode again.
But they are there, how can i help this problem away?
WEAPONS SAVE IS FIXED!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)