error 001: expected token: "=", but found "["

230 views Asked by At

got this error on this line:

const int restricted_weapons[] = { WEAPON_AK47, WEAPON_AWP, WEAPON_M4A4 };"

By the way this is SourcePawn i thought about something but it did not work

1

There are 1 answers

0
Charles On

Remove the const.

If the dimension of the array is known at compile time (seems to be the case in your example), add the dimension in between the brackets.

int restricted_weapons[3] = { WEAPON_AK47, WEAPON_AWP, WEAPON_M4A4 };

if the dimension is not known, use the new keyword:

int[] array = new int[size];