SA-MP Forums Archive
problem with enum - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: problem with enum (/showthread.php?tid=166989)



problem with enum - LZLo - 10.08.2010

Quote:

new teamScore[MAX_PLAYERS][pTeams];

enum pTeams
{
TEAM_POLICE,
TEAM_SWAT,
TEAM_ARMY,
TEAM_AMCSI,
TEAM_COLUMBIANO,
TEAM_KINA,
TEAM_TERRO
};

Quote:

Gang-Wars.pwn(80) : error 017: undefined symbol "pTeams"
Gang-Wars.pwn(80) : error 009: invalid array size (negative, zero or out of bounds)

2 errors
pls help


Re: problem with enum - JaTochNietDan - 10.08.2010

Quote:
Originally Posted by LZLo
Посмотреть сообщение
2 errors
pls help
pawn Код:
enum pTeams
{
TEAM_POLICE,
TEAM_SWAT,
TEAM_ARMY,
TEAM_AMCSI,
TEAM_COLUMBIANO,
TEAM_KINA,
TEAM_TERRO
};
new teamScore[MAX_PLAYERS][pTeams];
The Pawn compiler reads down, therefore it hasn't created pTeams yet before you initialize the variable.


Re: problem with enum - Nero_3D - 10.08.2010

You should put the enum before


Re: problem with enum - LZLo - 10.08.2010

an other problem xD

Quote:

enum pTeams
{
TEAM_POLICE,
TEAM_SWAT,
TEAM_ARMY,
TEAM_AMCSI,
TEAM_COLUMBIANO,
TEAM_KINA,
TEAM_TERRO
};
new teamScore[MAX_PLAYERS][pTeams];

onplayerdeath
Quote:

for(new i=0, m=GetMaxPlayers(); i<m; i++)//for(new i=0, m=GetMaxPlayers(); i<m; i++)
{
if(gTeam[playerid] == TEAM_POLICE)
{
teamScore[i][TEAM_POLICE]++;
if(teamScore[i][TEAM_POLICE] >= 50)
{
GameTextForAll("~w~Corleones Won",5000,0);
SetTimer("EndGM", 10000,0);
}
}
if(gTeam[playerid] == TEAM_SWAT)
{
teamScore[i][TEAM_POLICE]++;
if(teamScore[i][TEAM_POLICE] >= 50)
{
GameTextForAll("~w~Corleones Won",5000,0);
SetTimer("EndGM", 10000,0);
}
}
if(gTeam[playerid] == TEAM_ARMY)
{
teamScore[i][TEAM_ARMY]++;
if(teamScore[i][TEAM_ARMY] >= 50)
{
GameTextForAll("~w~Corleones Won",5000,0);
SetTimer("EndGM", 10000,0);
}
}
if(gTeam[playerid] == TEAM_AMCSI)
{
teamScore[i][TEAM_AMCSI]++;
if(teamScore[i][TEAM_AMCSI] >= 50)
{
GameTextForAll("~w~Corleones Won",5000,0);
SetTimer("EndGM", 10000,0);
}
}
if(gTeam[playerid] == TEAM_COLUMBIANO)
{
teamScore[i][TEAM_COLUMBIANO]++;
if(teamScore[i][TEAM_COLUMBIANO] >= 50)
{
GameTextForAll("~w~Corleones Won",5000,0);
SetTimer("EndGM", 10000,0);
}
}
if(gTeam[playerid] == TEAM_TERRO)
{
teamScore[i][TEAM_TERRO]++;
if(teamScore[i][TEAM_TERRO] >= 50)
{
GameTextForAll("~w~Corleones Won",5000,0);
SetTimer("EndGM", 10000,0);
}
}
if(gTeam[playerid] == TEAM_KINA)
{
teamScore[i][TEAM_KINA]++;
if(teamScore[i][TEAM_KINA] >= 50)
{
GameTextForAll("~w~Corleones Won",5000,0);
SetTimer("EndGM", 10000,0);
}
}
}

errors:
Quote:

D:\LETONAK2\gamemodes\Gang-Wars.pwn(890) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(891) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(899) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(900) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(90 : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(909) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(917) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(91 : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(926) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(927) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(935) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(935) : error 032: array index out of bounds (variable "teamScore")
D:\LETONAK2\gamemodes\Gang-Wars.pwn(936) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(936) : error 032: array index out of bounds (variable "teamScore")
D:\LETONAK2\gamemodes\Gang-Wars.pwn(944) : warning 213: tag mismatch
D:\LETONAK2\gamemodes\Gang-Wars.pwn(945) : warning 213: tag mismatch




Re: problem with enum - LZLo - 10.08.2010

solved!! thx all