Formatting Help
#1

So basically, I want to format something and then use it in an enum, like so:

Код:
format(gram, sizeof(gram), "Gram%d", pInfo[playerid][pTmpGram]);
iInfo[playerid][gram] = iInfo[playerid][gram] - 1;
Basically pTmpGram is set to a number based on what slot is chosen in an above dialog, so what I'm trying to do is make it so that it formats it to:
Gram1 or Gram2, etc.
And then [iInfo][playerid][gram] is really [iInfo][playerid][Gram1] or Gram2 etc.

However it gives me this error:

Код:
sarp.pwn(5027) : error 033: array must be indexed (variable "gram")
If I didn't explain this well please ask me to elaborate as I'm not that great at explaining.
Reply
#2

You need to add the size of gram like gram[size]
Since you have declared it as an array.
Reply
#3

Quote:
Originally Posted by DavidBilla
Посмотреть сообщение
You need to add the size of gram like gram[size]
Since you have declared it as an array.
Yes at the moment it is listed as:
gram[32]

Is that what you mean?
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
If it is already declared like that, then "gram2" is wrong even if you can get it to work, since that symbol doesn't exist. Use the other data directly as an index:

pawn Код:
iInfo[playerid][pInfo[playerid][pTmpGram]]
Also, your naming scheme makes my eyes hurt!
Haha, sorry, that's just how I do things, I don't know any better. Thanks for the help, I'll give this a try!
Reply
#5

Okay so I understand what you meant now, and I've changed the code accordingly:

Код:
iInfo[playerid][pInfo[playerid][pTmpGram]] = iInfo[playerid][pInfo[playerid][pTmpGram]] - 1;
However now the PAWN Compiler is giving me this error:

Код:
sarp.pwn(5025) : warning 213: tag mismatch
sarp.pwn(5025) : warning 215: expression has no effect
Reply
#6

Am I able to bump this? I still haven't found a solution, sorry if bumping isn't allowed.
Reply
#7

Quote:
Originally Posted by Joshayersm
Посмотреть сообщение
Am I able to bump this? I still haven't found a solution, sorry if bumping isn't allowed.
its already compiled, just an warning. you can test it now

Nevermind Warnings.. LOL
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)