Weapon saving
#1

Hello guys.
Im makeing a gamemode. I have made a login/register system that is using Dini for stat saveing.
I want to make is save the players weapons when he disconnects, and give him the weapons again whenm he connects.
I have already done like this:
This is from "OnPlayerDisconnect"
pawn Код:
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], weapons[i][1]);
(Those are line 107 - 110).
It gives me this error:
Код:
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(110) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Hope you guys can help me. Thank you.
Reply
#2

pawn Код:
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], weapons[i][1]);
}
Forgot the brackets?
Reply
#3

Quote:
Originally Posted by ~Yoshi
Посмотреть сообщение
pawn Код:
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], weapons[i][1]);
}
Forgot the brackets?
Close, but one warning:
Код:
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(111) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#4

Here is line 111 btw:
pawn Код:
dini_IntSet(file, "Weapons", weapons[i][0], weapons[i][1]);
Reply
#5

Quote:
Originally Posted by sim_sima
Посмотреть сообщение
Close, but one warning:
Код:
C:\Users\Simon\Desktop\samp server rpg\gamemodes\rpg-gm.pwn(111) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
You are trying to insert 2 variables into the same name. dini_SetInt works only with one argument.

Use different names for weapon id and ammo.
Reply
#6

Like
pawn Код:
new weapons[13], ammo[2];
            for(new i = 0; i < 13; i++)
            {
                GetPlayerWeaponData(playerid, i, weapons[i][0], ammo[i][1]);
                dini_IntSet(file, "Weapons", weapons[i][0], ammo[i][1]);
            }
??
Reply
#7

Quote:
Originally Posted by sim_sima
Посмотреть сообщение
Like
pawn Код:
new weapons[13], ammo[2];
            for(new i = 0; i < 13; i++)
            {
                GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
                dini_IntSet(file, "Weapons", weapons[i][0], ammo[i][1]);
            }
??
No, like this:
pawn Код:
new weapons[13][2];
for(new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    dini_IntSet(file, "Weapon1", weapons[i][0]);
    dini_IntSet(file, "Ammo1", weapons[i][1]);
}
Reply
#8

Ok, ill try it.
Reply
#9

Do i have to create a
"dini_IntSet(file, "Weapon1", weapons[i][0]);"
for every weapon slot?
Reply
#10

Quote:
Originally Posted by sim_sima
Посмотреть сообщение
Do i have to create a
"dini_IntSet(file, "Weapon1", weapons[i][0]);"
for every weapon slot?
That, or use the loop!

pawn Код:
new weapons[13][2], Str[30];
for(new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
    format( Str, 30, "Weapon%d", i );
    dini_IntSet(file, Str, weapons[i][0]);
    format( Str, 30, "Ammo%d", i );
    dini_IntSet(file, "Ammo1", weapons[i][1]);
}
This will create from Weapon0 to Weapon12 also Ammo0 to Ammo12.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)