Command not working properly. -
I have this command to take over properties by a gang so they can earn profit from it. When I attack it by myself it works, saying this:
But when there are 2 members or more of that gang online, when I do /attack, nothing happens ..
pawn Код:
CMD:attack( playerid, params[] )
{
new szString[128];
for(new i = 1; i < MAX_PROPS /*12*/; i++)
{
if ( IsPlayerInRangeOfPoint( playerid, 5.0, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ] ) )
{
if ( PropInfo[i][OwnerTeam] == Team[playerid] ) // If a gang owns it
{
SendClientMessage( playerid, COLOR_LIGHTRED, "ERROR: You own this property so you can't take it over.");
}
else
{
if ( GetTeamPlayersInRangeOfPoint( Team[playerid], 10, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ] ) >= 3 /* 3 */ )
{
new AttackersAmmount = GetTeamPlayersInRangeOfPoint( Team[playerid], 5, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ] );
if ( Team[playerid] == TEAM_CJUSTICE )
{
AttackTimer[i] = SetTimerEx( "AttackSecond", 1000, true, "ddb", Team[playerid], i, true );
foreach(Player, ii)
{
if ( Team[ii] == Team[playerid] )
{
format( szString, 128, "{9fb84a}* Police Dispatch: There is a raid on progress at %s with %d members! Serve and protect!", PropInfo[i][Name], AttackersAmmount );
SendClientMessage( ii, -1, szString );
SetPlayerCheckpoint( ii, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ], 7.0 );
return 1;
}
else if ( Team[ii] != Team[playerid] )
{
format( szString, 128, "{9fb84a}* The cops are raiding %s with %d members! Don't let the pigs take it!", GetGangName( Team[playerid] ), PropInfo[i][Name], AttackersAmmount );
SendClientMessage( ii, -1, szString );
SetPlayerCheckpoint( ii, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ], 7.0 );
return 1;
}
}
}
else if ( Team[playerid] != TEAM_CJUSTICE )
{
AttackTimer[i] = SetTimerEx( "AttackSecond", 1000, true, "ddb", Team[playerid], i, false );
SetTimerEx( "SendAlertToPolice", 60000, false, "dd", Team[playerid], i );
foreach(Player, ii)
{
if ( Team[ii] == Team[playerid] )
{
format( szString, 128, "{9fb84a}* %s has begun an attack on %s with %d members! We gotta take it, go for 'em!", GetGangName( Team[playerid] ), PropInfo[i][Name], AttackersAmmount );
SendClientMessage( ii, -1, szString );
SetPlayerCheckpoint( ii, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ], 7.0 );
return 1;
}
else if ( ( Team[ii] != Team[playerid] ) && Team[ii] != TEAM_CJUSTICE )
{
format( szString, 128, "{9fb84a}* %s has begun an attack on %s with %d members! The fuck!? We are being attacked, don't let 'em take it!", GetGangName( Team[playerid] ), PropInfo[i][Name], AttackersAmmount );
SendClientMessage( ii, -1, szString );
SetPlayerCheckpoint( ii, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ], 7.0 );
return 1;
}
}
}
}
else
{
new AttackersAmmount = GetTeamPlayersInRangeOfPoint( Team[playerid], 5, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ] );
foreach(Player, ii)
{
if ( Team[ii] == Team[playerid] )
{
if ( Team[playerid] != TEAM_CJUSTICE )
{
format( szString, 128, "{9fb84a}* %s is trying to do an attack on %s! More members needed (%d/3).", GetGangName( Team[playerid] ), PropInfo[i][Name], AttackersAmmount );
}
else if ( Team[playerid] == TEAM_CJUSTICE )
{
format( szString, 128, "{9fb84a}* Police Dispatch: There is a raid attempt at %s with %d members! We need backup here, over.", PropInfo[i][Name], AttackersAmmount );
SendClientMessage( ii, -1, szString );
}
SendClientMessage( ii, -1, szString );
SetPlayerCheckpoint( ii, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ], 7.0 );
return 1;
}
}
}
}
}
}
return 1;
}