SA-MP Forums Archive
A little help :) - 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)
+--- Thread: A little help :) (/showthread.php?tid=632727)



A little help :) - Kraeror - 18.04.2017

Hello guys, I made territory attack command and i need to check if defender team have enough members (4)!

Here is the simple code:
Quote:

if(strcmp(cmd, "/GangWar", true) == 0)
{
for (new i = 0; i < MAX_TERRITORIES; i++)
{
if(TerritoryInfo[i][TerritoryOwner] != TEAM_CIVIL) TerritoryDefender = TerritoryInfo[i][TerritoryOwner];
}
//>>>>>>>>>>>>>>>>>Here i want to check if there is 6 members from TerritoryDefender<<<<<<<<<<<<<<<<<<<<<<<<
for (new i = 0; i < MAX_TERRITORIES; i++)
{
//ect.
}
}

Can you help me please. I will REP+ you!


Re: A little help :) - khRamin78 - 18.04.2017

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Hello guys, I made territory attack command and i need to check if defender team have enough members (4)!

Here is the simple code:


Can you help me please. I will REP+ you!
PHP код:
// you can do like this
new Defendersteam;
for(new 
i;i<MAX_PLAYERS;i++)
{
    if(
/*here check if player is in that team like >>Player[i][Team] == ...*/)
    {
        
Defendersteam++;
    }
}
if(
Defendersteam >= 4//and for checking defendersteam enough member
{
// do sth if its more than 4

i hope you understand what i meant sory for my bad eng