Weapon saving etc... -
[JnA]DukeNukem - 04.08.2011
here's the script:
Код:
new bullets[MAX_PLAYERS][12];
new weapons[MAX_PLAYERS][12];
GetPlayerWeaponData(playerid,1,weapons[playerid][0],bullets[playerid][0]);
GetPlayerWeaponData(playerid,2,weapons[playerid][1],bullets[playerid][1]);
GetPlayerWeaponData(playerid,3,weapons[playerid][2],bullets[playerid][2]);
GetPlayerWeaponData(playerid,4,weapons[playerid][3],bullets[playerid][3]);
GetPlayerWeaponData(playerid,5,weapons[playerid][4],bullets[playerid][4]);
GetPlayerWeaponData(playerid,6,weapons[playerid][5],bullets[playerid][5]);
GetPlayerWeaponData(playerid,7,weapons[playerid][6],bullets[playerid][6]);
GetPlayerWeaponData(playerid,8,weapons[playerid][7],bullets[playerid][7]);
GetPlayerWeaponData(playerid,9,weapons[playerid][8],bullets[playerid][8]);
GetPlayerWeaponData(playerid,10,weapons[playerid][9],bullets[playerid][9]);
GetPlayerWeaponData(playerid,11,weapons[playerid][10],bullets[playerid][10]);
GetPlayerWeaponData(playerid,12,weapons[playerid][11],bullets[playerid][11]);
dini_IntSet(playerFile,"weapon0",weapons[playerid][0]);
dini_IntSet(playerFile,"weapon1",weapons[playerid][1]);
dini_IntSet(playerFile,"weapon2",weapons[playerid][2]);
dini_IntSet(playerFile,"weapon3",weapons[playerid][3]);
dini_IntSet(playerFile,"weapon4",weapons[playerid][4]);
dini_IntSet(playerFile,"weapon5",weapons[playerid][5]);
dini_IntSet(playerFile,"weapon6",weapons[playerid][6]);
dini_IntSet(playerFile,"weapon7",weapons[playerid][7]);
dini_IntSet(playerFile,"weapon8",weapons[playerid][8]);
dini_IntSet(playerFile,"weapon9",weapons[playerid][9]);
dini_IntSet(playerFile,"weapon10",weapons[playerid][10]);
dini_IntSet(playerFile,"weapon11",weapons[playerid][11]);
dini_IntSet(playerFile,"weapon12",weapons[playerid][12]);
dini_IntSet(playerFile,"bullets0",bullets[playerid][0]);
dini_IntSet(playerFile,"bullets1",bullets[playerid][1]);
dini_IntSet(playerFile,"bullets2",bullets[playerid][2]);
dini_IntSet(playerFile,"bullets3",bullets[playerid][3]);
dini_IntSet(playerFile,"bullets4",bullets[playerid][4]);
dini_IntSet(playerFile,"bullets5",bullets[playerid][5]);
dini_IntSet(playerFile,"bullets6",bullets[playerid][6]);
dini_IntSet(playerFile,"bullets7",bullets[playerid][7]);
dini_IntSet(playerFile,"bullets8",bullets[playerid][8]);
dini_IntSet(playerFile,"bullets9",bullets[playerid][9]);
dini_IntSet(playerFile,"bullets10",bullets[playerid][10]);
dini_IntSet(playerFile,"bullets11",bullets[playerid][11]);
dini_IntSet(playerFile,"bullets12",bullets[playerid][12]);
and here are the errors
:
Код:
C:\DOCUME~1\Admin\Desktop\srvr\GAMEMO~1\test.pwn(223) : error 032: array index out of bounds (variable "weapons")
C:\DOCUME~1\Admin\Desktop\srvr\GAMEMO~1\test.pwn(237) : error 032: array index out of bounds (variable "bullets")
EDIT : works fine, but doesn't SAVE AMMO
AW: Weapon saving etc... -
Drebin - 04.08.2011
Wich one of these is line 223 and 237 ?
Re: Weapon saving etc... -
[JnA]DukeNukem - 04.08.2011
it's dini_IntSet(playerFile,"bullets3",bullets[playerid][3]);
but i deleted it and still error on same line!
AW: Weapon saving etc... -
Drebin - 04.08.2011
pawn Код:
new bullets[MAX_PLAYERS][13];
new weapons[MAX_PLAYERS][13];
Also, you get the data of 12 weapons, but you save 13 into the playerfile ...
Re: Weapon saving etc... -
[JnA]DukeNukem - 04.08.2011
Danke ! That's uhm great ! fixed it
+rep!
Re: Weapon saving etc... -
[JnA]DukeNukem - 04.08.2011
Now it saves weapons, but doesn't save the ammo, anyone have ideas
Re: Weapon saving etc... -
Toreno - 04.08.2011
I might not help you with this problem, but that's annoying to see people keep working with dini when they have Y_INI, which is faster, better, and have much more new futures. Even if you will fix this problem, dini is the slowest file reading and writing, so you will need to change this in future. WHY not changing now? Y_INI is the best.
Also, try this;
pawn Код:
new weapons[13][2];
for(new i; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
dini_IntSet(bestand, "Weap0", weapons[0][0]);
dini_IntSet(bestand, "Ammo0", weapons[0][1]);
dini_IntSet(bestand, "Weap1", weapons[1][0]);
dini_IntSet(bestand, "Ammo1", weapons[1][1]);
dini_IntSet(bestand, "Weap2", weapons[2][0]);
dini_IntSet(bestand, "Ammo2", weapons[2][1]);
dini_IntSet(bestand, "Weap3", weapons[3][0]);
dini_IntSet(bestand, "Ammo3", weapons[3][1]);
dini_IntSet(bestand, "Weap4", weapons[4][0]);
dini_IntSet(bestand, "Ammo4", weapons[4][1]);
dini_IntSet(bestand, "Weap5", weapons[5][0]);
dini_IntSet(bestand, "Ammo5", weapons[5][1]);
dini_IntSet(bestand, "Weap6", weapons[6][0]);
dini_IntSet(bestand, "Ammo6", weapons[6][1]);
dini_IntSet(bestand, "Weap7", weapons[7][0]);
dini_IntSet(bestand, "Ammo7", weapons[7][1]);
dini_IntSet(bestand, "Weap8", weapons[8][0]);
dini_IntSet(bestand, "Ammo8", weapons[8][1]);
dini_IntSet(bestand, "Weap9", weapons[9][0]);
dini_IntSet(bestand, "Ammo9", weapons[9][1]);
dini_IntSet(bestand, "Weap10", weapons[10][0]);
dini_IntSet(bestand, "Ammo10", weapons[10][1]);
dini_IntSet(bestand, "Weap11", weapons[11][0]);
dini_IntSet(bestand, "Ammo11", weapons[11][1]);
dini_IntSet(bestand, "Weap12", weapons[12][0]);
dini_IntSet(bestand, "Ammo12", weapons[12][1]);
I'm still recommending you to change your file reading and writing include, really recommended.