Problem with array containing textdraws
#1

I have an array with an enumeration:
pawn Код:
enum
    Enumeration
    {
        Text:CLOCK[MAX_PLAYERS] // A textdraw showing a different clock for each player.
    };

new TD_Array[Enumeration];
The compiler didn't complain about that code and it was working fine (the textdraw was working). Then I tried to add a new textdraw called "WEBSITE":
pawn Код:
enum
    Enumeration
    {
        Text:CLOCK[MAX_PLAYERS], // A textdraw showing a different clock for each player.
        Text:WEBSITE // Textdraw showing the server website to all the players.
    };

new TD_Array[Enumeration];
And got these errors:
Код:
Line(219) : error 001: expected token: "-identifier-", but found "-string-"
Line(220) : error 010: invalid function or declaration
Line(442) : error 001: expected token: "-string end-", but found "-identifier-"
Line(443) : error 001: expected token: "-string end-", but found "-identifier-"
Line(444) : error 001: expected token: "-string end-", but found "-identifier-"
Line(445) : error 001: expected token: "-string end-", but found "-identifier-"
Line(446) : error 001: expected token: "-string end-", but found "-identifier-"
Line(447) : error 001: expected token: "-string end-", but found "-identifier-"
Line(448) : error 001: expected token: "-string end-", but found "-identifier-"
Line(449) : error 001: expected token: "-string end-", but found "-identifier-"
Line(450) : error 001: expected token: "-string end-", but found "-identifier-"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


11 Errors.
Lines 219 - 220:
pawn Код:
enum
    TextDrawGroups
    {
        Text:CLOCK[MAX_PLAYERS], // 219
        Text:WEBSITE // 220
    };
Other lines:
pawn Код:
TextDraw[WEBSITE] = TextDrawCreate(141.000000, 420.000000, "thelsw.com");
TextDrawAlignment(TextDraw[WEBSITE], 3);
TextDrawBackgroundColor(TextDraw[WEBSITE], BLACK);
TextDrawFont(TextDraw[WEBSITE], 1);
TextDrawLetterSize(TextDraw[WEBSITE], 0.57, 2.8);
TextDrawColor(TextDraw[WEBSITE], PlayerColor[random(sizeof(PlayerColor))]);
TextDrawSetOutline(TextDraw[WEBSITE], 1);
TextDrawSetProportional(TextDraw[WEBSITE], 1);
TextDrawShowForAll(TextDraw[WEBSITE]);
Can anyone help me please?
Reply
#2

Bump!
Reply
#3

enum
TextDrawGroups
{
Text:CLOCK[MAX_PLAYERS],
Text:[WEBSITE],
};
new TD_Array[Enumeration];
Reply
#4

I'm such an idiot, I defined WEBSITE twice!

Thanks to Ricop522 for trying to help me.

This is what was happening:
pawn Код:
#define WEBSITE "www.mywebsite.com" // First definition.

enum
    Enumeration
    {
        Text:CLOCK[MAX_PLAYERS],
        Text:WEBSITE // You can not define it twice!
    };

new TD_Array[Enumeration];
Solution: either removing one of them (variable - definition) or changing its name to something else.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)