PDA

View Full Version : invalid subscript (not an array or too many subscripts): "asicerik"


rappy93
28/01/2014, 05:07 PM
Hi .. I have these errors and I dont really understand why .

rp.pwn(9560) : error 028: invalid subscript (not an array or too many subscripts): "asicerik"
rp.pwn(9560) : warning 215: expression has no effect
rp.pwn(9560) : error 001: expected token: ";", but found "]"
rp.pwn(9560) : error 029: invalid expression, assumed zero
rp.pwn(9560) : fatal error 107: too many error messages on one line


case GRAFITI_DIALOG1:
{
switch(listitem)
{
case 0:
{
if(response)
{
Graffiti[playerid][active_character[playerid]][asicerik] == inputtext; // line 9560
ShowPlayerDialog(playerid, GRAFITI_DIALOG2, DIALOG_STYLE_LIST, "Graffiti", "Culoare\nDimensiune\nTip(arial vs.)\nOlus,tip", "Okay", "Cancel");
}
}
}
}


Graffiti enum :



enum grafInfo
{
Grafid,
Owner,
Float:aX,
Float:aY,
Float:aZ,
Float:bX,
Float:bY,
Float:bZ,
gType,
Size1,
Color,
asicerik,
};

new Graffiti[MAX_GRAFFITI][grafInfo];



Anyone has any idea?

Konstantinos
28/01/2014, 05:19 PM
If asicerik should be an integer, then it'd be:

Graffiti[GRAFFITI_ID_HERE][asicerik] == strval(inputtext);

Else if it should be a string, then it'd be:

strcat((Graffiti[GRAFFITI_ID_HERE][asicerik][0] = '\0', Graffiti[GRAFFITI_ID_HERE][asicerik]), inputtext, SIZE_HERE);

and in the enum:

asicerik[SIZE_HERE]


Of course, GRAFFITI_ID_HERE and SIZE_HERE should be modified.

rappy93
28/01/2014, 05:40 PM
Thanks,I'll try it and let you know.

rappy93
28/01/2014, 09:44 PM
I took your advice with the "strcat" function and now it returns three of these erorrs :

error 029: invalid expression, assumed zero

code :


strcat(([playerid][active_character[playerid]][asicerik][0] = '\0', Graffiti[playerid][active_character[playerid]][asicerik]), inputtext, 128);

Konstantinos
29/01/2014, 12:06 PM
You forgot "Graffiti" before [playerid].


strcat((Graffiti[playerid][active_character[playerid]][asicerik][0] = '\0', Graffiti[playerid][active_character[playerid]][asicerik]), inputtext, 128);


A way easier would be to use macro for it:

#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)

and the usage:

strcpy(Graffiti[playerid][active_character[playerid]][asicerik], inputtext, 128);


Note that the array should be declared:

new Graffiti[MAX_PLAYERS][MAX_GRAFFITI][grafInfo];

since you have one more index (playerid).

rappy93
29/01/2014, 04:14 PM
Damn me, I forgot Graffiti there hehe...

Anyways,tried it and now it shows me


warning 213: tag mismatch
error 001: expected token: ")", but found "["
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line


LE : Redeclaring that variable with MAX_PLAYERS seemed th change what errors I receive. Let me try to fix most of them and I'll come back with a reply if I encounter the same one as above.

Konstantinos
29/01/2014, 04:17 PM
Post the code and comment the errors/warnings on them.

rappy93
29/01/2014, 04:30 PM
Now I get these.

error 035: argument type mismatch (argument 2)
error 035: argument type mismatch (argument 4)

On this line :

CreateObject(19482, Graffiti[grafid][aX], Graffiti[grafid][aY], Graffiti[grafid][aZ], 0.0, 96.0);

rappy93
29/01/2014, 05:27 PM
Bump .. anyone has any idea?