Array with no value
#1

What do i doing wrong on this script?
Код:
SMP.pwn(27978) : warning 219: local variable "plane" shadows a variable at a preceding level
SMP.pwn(27978) : error 009: invalid array size (negative, zero or out of bounds)
SMP.pwn(27978) : error 036: empty statement
SMP.pwn(27980) : error 017: undefined symbol "plane"
SMP.pwn(27980) : warning 215: expression has no effect
SMP.pwn(27980) : error 001: expected token: ";", but found "]"
SMP.pwn(27980) : error 029: invalid expression, assumed zero
SMP.pwn(27980) : fatal error 107: too many error messages on one line

CompSMPation aborted.

Pawn compSMPer 3.10.20150531	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
[Finished in 23.6s with exit code 1]
[cmd: ['pawncc', 'SMP.pwn', '-;+', '-v2', '-d3', '-Z+', '-\\)+']]
[dir: /home/tiago/Documents/sampserver/gamemodes]
[path: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games]
Код:
CMD:buyveh(playerid) {
    new index = -1;
    new plane[]; // 27978
    while(++index < sizeof Concesssionaria) {
        plane[index] = Concesssionaria[index][modelo]; // 27980
    }
    ShowModelSelectionMenuEx(playerid, plane, index, "Buy Vehicle", DIALOGID_BUYVEH, 16.0, 0.0, -55.0);
    return 1;
}
Reply
#2

new plane[sizeof Concesssionaria];
Reply
#3

Quote:
Originally Posted by xMoBi
Посмотреть сообщение
new plane[sizeof Concesssionaria];
Ignore this partially...


You've got 2 plane variables, and your second 'usage' of it is wrong and different to what it was defined as. If anything do as above, but change it's name to
Код:
new planetemp[sizeof Concesssionaria];
and address it in this loop as so.

You should be careful using variable names that are close, as they really can trip you up.
Reply
#4

Thank you guys! I didn't know that i could be done on this way, thanks.
+rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)