Problem, please help
#1

Hello, I have problem with checking the players in the gang war! I made command and all works, but when I'm checking the players and if the players from the defender team are less then 2, it send me message! But now, when I write /GangWar, allways and anywhere I am and in the server are 2 players from the defender team, it send me the message! Please help me, here is the code:
Command:
Quote:

if(strcmp(cmd, "/GangWar", true) == 0)
{
for (new i = 0; i < MAX_TERRITORIES; i++)
{
if(GetTeamMembers(TerritoryInfo[i][TerritoryOwner]) < 2) return SendClientMessage(playerid, COLOR_RED, "No one is from the defender team!");
}
for (new i = 0; i < MAX_TERRITORIES; i++)
{
//Here is my code....
}
return 1;
}

stock:
Quote:

stock GetTeamMembers(teamid)
{
new tmemb = 0;
for(new t; t < MAX_PLAYERS; t++)
{
if(IsPlayerConnected(t) && PlayerInfo[t][pMember] == teamid)
{
tmemb++;
}
}
return tmemb;
}

Reply
#2

You need to check if the player is in the territory first. That is the problem, do you store the minX, minY, maxX, maxY of each territory?
Reply
#3

Quote:
Originally Posted by Marricio
Посмотреть сообщение
You need to check if the player is in the territory first. That is the problem, do you store the minX, minY, maxX, maxY of each territory?
Thanks you a lot!!!!!!!!!!! You helped me a lot i will REP+ you !!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)