PDA

View Full Version : error 021: symbol already defined


Johangelo1
23/03/2017, 03:39 PM
How could you solve this error?


error 021: symbol already defined: "EventInfo"



enum EventInfo
{
Float:Xq, Float:Yq, Float:Zq, Float:Aq,
Nome[64], Aberto, Criado, Cerrado,
Premio1, Premio2, Premio3, PremioS,
Cor1, Cor2, Arma, Admin[64],
Vida,
};
new EventInfo[MAX_PLAYERS];


//Line where it gives the error
if(EventInfo[Criado] == 0)//error
{
ShowPlayerDialog(playerid, DIALOG_EVENTO, DIALOG_STYLE_LIST, "Own Event: Closed", Mensagem, "Selecc", "Cancel");
}
else if(EventInfo[Criado] == 1) //error
{
new StrE[1000];
format(StrE,sizeof(StrE),"Own Event: Opened by %s",EventInfo[Admin]);
ShowPlayerDialog(playerid, DIALOG_EVENTO, DIALOG_STYLE_LIST, StrE, Mensagem, "Selecc", "Cancel");
}

ISmokezU
23/03/2017, 03:42 PM
Don't do it like that.

enum EventInfo
{
Float:Xq, Float:Yq, Float:Zq, Float:Aq,
Nome[64], Aberto, Criado, Cerrado,
Premio1, Premio2, Premio3, PremioS,
Cor1, Cor2, Arma, Admin, // Admin[64] Why 64?
Vida,
};
new Player[MAX_PLAYERS][EventInfo];

if(Player[playerid][Criado] == 0)
{
ShowPlayerDialog(playerid, DIALOG_EVENTO, DIALOG_STYLE_LIST, "Own Event: Closed", Mensagem, "Selecc", "Cancel");
}
else if(Player[playerid][Criado] == 1)
{
new StrE[ 75 ];
format(StrE,sizeof(StrE),"Own Event: Opened by %s",Player[playerid][Admin]); //Still think we need a GetName Function here
ShowPlayerDialog(playerid, DIALOG_EVENTO, DIALOG_STYLE_LIST, StrE, Mensagem, "Selecc", "Cancel");
}

Read up more on Enums here (http://forum.sa-mp.com/showthread.php?t=318307) :)

Johangelo1
23/03/2017, 04:07 PM
thanks you :D