[HELP]Need 3people to gangattack.
#1

Hey all .

I've made an gangsystem with turfs which you can attack with a command like /gattack.
But i want to make that gangs only can attack when 3of the same gang are in the turf they want to attack.
Reply
#2

Now GetPlayerZone isn't a native function, I don't know what you're using to check the gang zones.

pawn Код:
new count = 0;
for(new i; i < MAX_PLAYERS; i++)
{
if(GetPlayerTeam(playerid) == GetPlayerTeam(i) && GetPlayerZone(playerid) == GetPlayerZone(i))
{
count++;
}
}
if(count < 3) return SendClientMessage(playerid,COLOR_RED,"There aren't 3 homies in yo' turf fool!");
//Continue
Reply
#3

pawn Код:
for(new a = 0, b = GetMaxPlayers(); a < b; a++)
{
    new GangMembersInTurf = 0;
   
    if(Gang[a] == Gang[playerid] && Turf[a] == Turf[playerid])
    {
        GangMembersInTurf++;
   
        if(GangMembersInTurf >= GANG_MEMBERS_FOR_ATTACK)
        {
            // Do s00m33 funnkeh st00f.
         
        }
        format(str,sizeof(str),"You need %d Gangmembers in the turf you want to attack.", GANG_MEMBERS_FOR_ATTACK);
        SendClientMessage(playerid, red, str);
        return 1;
    }
    return 1;
}
You didn't give me any information on how you arrays for gangs or whatever is set up so I just made up some.

Now, this could be hugely improved depending on how your arrays and gangs are set up, so I've just done it very basic (2 loops :<)

I assume you know what to replace and where.

EDIT: Just like above, though I wasn't sure if you where set up to use arrays/varibles or functions or whatever.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)