Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Store int value in an array

$
0
0
I'm trying to store a value in an array but it doesn't work.

new Fish[MAX_PLAYERS][2];

At OnPlayerConnect I have Fish[playerid][0] = 0; and Fish[playerid][1] = 0;

In that 2 variables (I have 2 because a player can hold 2 fish) I want to store the type of fish which is from 0 to 9.
But when I try to store a fish type bigger than 1 I get:

[23:36:47] [debug] Run time error 4: "Array index out of bounds"
[23:36:47] [debug] Accessing element at index 2 past array upper bound 1

How can I store a value in that 2 fish variables?

Viewing all articles
Browse latest Browse all 18226

Trending Articles