SA-MP Forums Archive
a a small problem :D - 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: a a small problem :D (/showthread.php?tid=166996)



a a small problem :D - 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: a a small problem :D - JaTochNietDan - 10.08.2010

Can you show where you create gTeam and define the TEAM_ stuff?


Re: a a small problem :D - LZLo - 10.08.2010

Quote:

static gTeam[MAX_PLAYERS];
new gPlayerClass[MAX_PLAYERS];

/
Quote:

/ Teams
#define TEAM_POLICE 1
#define TEAM_SWAT 2
#define TEAM_ARMY 3
#define TEAM_AMCSI 4
#define TEAM_COLUMBIANO 5
#define TEAM_KINA 6
#define TEAM_TERRO 7

eighout?


Re: a a small problem :D - LZLo - 10.08.2010

do you need more?


Re: a a small problem :D - JaTochNietDan - 10.08.2010

Wait wait, why do you have a variable for each player and each team? It seems that what you're trying to do would be much better done like so.

pawn Код:
enum pTeams
{
TEAM_POLICE,
TEAM_SWAT,
TEAM_ARMY,
TEAM_AMCSI,
TEAM_COLUMBIANO,
TEAM_KINA,
TEAM_TERRO
};
new teamScore[pTeams];
OnPlayerDeath

pawn Код:
if(gTeam[playerid] == TEAM_POLICE)
{
    teamScore[TEAM_POLICE]++;
    if(teamScore[TEAM_POLICE] >= 50)
    {
        GameTextForAll("~w~Corleones Won",5000,0);
        SetTimer("EndGM", 10000,0);
    }
}
//and so on...
No need for a loop, there's no reason that you'd want to store a seperate team score for each player since the team score is for everyone in that team.

On another note is there any specific reason you're using a static type variable for gTeam? I recommend a normal one.


Re: a a small problem :D - LZLo - 10.08.2010

big thx, JaTochNietDan