Formatting Help - 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: Formatting Help (
/showthread.php?tid=538387)
Formatting Help -
Joshayersm - 21.09.2014
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.
Re: Formatting Help -
DavidBilla - 21.09.2014
You need to add the size of gram like gram[size]
Since you have declared it as an array.
Re: Formatting Help -
Joshayersm - 21.09.2014
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?
Re: Formatting Help -
Joshayersm - 21.09.2014
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!
Re: Formatting Help -
Joshayersm - 21.09.2014
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
Re: Formatting Help -
Joshayersm - 22.09.2014
Am I able to bump this? I still haven't found a solution, sorry if bumping isn't allowed.
Re: Formatting Help -
XGreen - 22.09.2014
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