Macros (?) for enums/arrays
#1

I have an enum/array for player data, but instead of having to put

pData[playerid][pName]

I tried this:

#define pName[%1] pData[%1][pName]

to allow me to just put

pName[playerid]

but I got a bunch of errors:

Quote:

(32) : error 001: expected token: "}", but found "["
(35) : error 021: symbol already defined: "pData"
(71) : error 028: invalid subscript (not an array or too many subscripts): "pData"
(71) : warning 215: expression has no effect
(71) : error 001: expected token: ";", but found "]"
(71) : error 029: invalid expression, assumed zero
(71) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.

:/

Here's all the stuff:

pawn Код:
#define pName[%1] pData[%1][pName]

enum E_PDATA
{
    pLoginStatus,
    pName[MAX_PLAYER_NAME] // Line 32
}

new pData[MAX_PLAY][E_PDATA]; // Line 35

public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME); // Line 71
}
Reply


Messages In This Thread
Macros (?) for enums/arrays - by MP2 - 17.01.2012, 14:32
Re: Macros (?) for enums/arrays - by SuperViper - 17.01.2012, 14:36
Re: Macros (?) for enums/arrays - by T0pAz - 17.01.2012, 14:41
Re: Macros (?) for enums/arrays - by MP2 - 17.01.2012, 14:42
Re: Macros (?) for enums/arrays - by T0pAz - 17.01.2012, 14:46
Re: Macros (?) for enums/arrays - by MP2 - 17.01.2012, 14:59
Re: Macros (?) for enums/arrays - by MP2 - 17.01.2012, 15:20
Re: Macros (?) for enums/arrays - by T0pAz - 17.01.2012, 15:22
Re: Macros (?) for enums/arrays - by MP2 - 17.01.2012, 15:27
Re: Macros (?) for enums/arrays - by thimo - 17.01.2012, 18:31

Forum Jump:


Users browsing this thread: 1 Guest(s)