[HELP]Need 3people to gangattack. - 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: [HELP]Need 3people to gangattack. (
/showthread.php?tid=155953)
[HELP]Need 3people to gangattack. -
Lutsen - 20.06.2010
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.
Re: [HELP]Need 3people to gangattack. -
Hiddos - 20.06.2010
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
Re: [HELP]Need 3people to gangattack. -
Joe_ - 20.06.2010
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.