How come I get this error ?
#1

pawn Код:
new saveammoex[MAX_PLAYERS][13];
format(string, 128, "GunId%d", s);
if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[MAX_PLAYERS][pGunz][s] = strval( val ); }
format(string, 128, "Ammo%d",val);
if( strcmp( key, string, true ) == 0) { val = ini_GetValue ( Data ); saveammoex[MAX_PLAYERS][s] = strval ( val ); }
Oh I forgot the error
error 032: array index out of bounds (variable "saveammoex
Reply
#2

Bump
Guys my thread went to page 2
Reply
#3

Increase the "13" to a higher number.
Reply
#4

Quote:
Originally Posted by Mr.Anonymous
Посмотреть сообщение
Increase the "13" to a higher number.
Ey thanks for the reply.
I think the problem is with the MAX_PLAYERS here:
if( strcmp( key, string, true ) == 0) { val = ini_GetValue ( Data ); saveammoex[MAX_PLAYERS][s] = strval ( val ); }

because when I replace it with 499 or anything else the error is gone
Reply
#5

yes because your not using it correctly!
pawn Код:
new saveammoex[MAX_PLAYERS][13];
format(string, 128, "GunId%d", s);
if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGunz][s] = strval( val ); }
format(string, 128, "Ammo%d",val);
if( strcmp( key, string, true ) == 0) { val = ini_GetValue ( Data ); saveammoex[playerid][s] = strval ( val ); }
When you declared the "MAX_PLAYERS" is basically a define of "500" which then is set to the variable which means the variables is now an Arrey. which holds "MAX_PLAYERS" slots in it so it can store values in it for "MAX_PLAYERS"/"500" playerid.
So later on you will have to tell the script which exact playerid you want.
Quote:

This forum requires that you wait 120 seconds between posts

damm ;X
Reply
#6

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
yes because your not using it correctly!
pawn Код:
new saveammoex[MAX_PLAYERS][13];
format(string, 128, "GunId%d", s);
if( strcmp( key , string , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGunz][s] = strval( val ); }
format(string, 128, "Ammo%d",val);
if( strcmp( key, string, true ) == 0) { val = ini_GetValue ( Data ); saveammoex[playerid][s] = strval ( val ); }
When you declared the "MAX_PLAYERS" is basically a define of "500" which then is set to the variable which means the variables is now an Arrey. which holds "MAX_PLAYERS" slots in it so it can store values in it for "MAX_PLAYERS"/"500" playerid.
So later on you will have to tell the script which exact playerid you want.
damm ;X
Thanks for the reply !
Damn man ...
sorry for being so stupid . but .. what should I do know lol
Reply
#7

Guys page 2 !
Bump ... help plz !
Reply
#8

the code i gave you should work fine if the is any playerid in the callback your using it.
did you try it out ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)