Getting Errors and I have no Clue why. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Getting Errors and I have no Clue why. (
/showthread.php?tid=396447)
Getting Errors and I have no Clue why. -
ShawtyyMacJunior - 30.11.2012
Someone please tell me whats wrong with this code. Im familiar with PAWN and the codes, but im still new to some.
I get the Error : error 033:array must be indexed(variable"mage")
Код:
new mage[999];
if(PlayerInfo[targetid][pMID] == 1) {mage = 32}
else if(PlayerInfo[targetid][pMID] == 2) {mage = 26}
else if(PlayerInfo[targetid][pMID] == 3) {mage = 21}
else if(PlayerInfo[targetid][pMID] == 4) {mage = 36}
else if(PlayerInfo[targetid][pMID] == 5) {mage = 23}
else if(PlayerInfo[targetid][pMID] == 6) {mage = 22}
else if(PlayerInfo[targetid][pMID] == 7) {mage = 30}
else if(PlayerInfo[targetid][pMID] == 8) {mage = 20}
else if(PlayerInfo[targetid][pMID] == 9) {mage = 29}
else if(PlayerInfo[targetid][pMID] == 10) {mage = 25}
Re: Getting Errors and I have no Clue why. -
AndreT - 30.11.2012
You create mage as an array so when accessed, you must specify an index, for example:
pawn Код:
new mage[999];
mage[998] = 10; // VALID
mage = 10; // INVALID
If in your case you meant that 999 should be the amount of players, then better use MAX_PLAYERS to create your array:
and add an index to your code lines:
If this is not correct then explain what you are trying to do