SA-MP Forums Archive
isplayerindynamicarea problem - 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: isplayerindynamicarea problem (/showthread.php?tid=515950)



isplayerindynamicarea problem - iThePunisher - 28.05.2014

i have a problem when someone starts capturing a zone with all the team, if the player who started capturing dies the zone fails to be captured!!!
i wanna do it only if all the team dies then the zone will fail...
so can anyone help ? thanks

pawn Код:
public onplayerdeath...
{
   if(IsPlayerInDynamicArea(playerid, testRect))
    {
        UnderAttack[test] = 0;
        GangZoneStopFlashForAll(Zone[test]);
        KillTimer(timer[playerid][test]);
    }
        return 1;
}



Re: isplayerindynamicarea problem - iThePunisher - 30.05.2014

anyone know how can i fix this?


Re : isplayerindynamicarea problem - S4t3K - 30.05.2014

Create a lobal var per team.

Each time a player who has a team enter a dynamic area, you increment the team's var.
Each time a player who has a team exits a dynamic area, you decrement the team's var.
Each time a player who has a team dies in a dynamic area, you decrement the team's var.

Kill the timer, stop flashing etc only when it was the last player of the team in the area (so basically when the var's value is 1).


Re: isplayerindynamicarea problem - iThePunisher - 30.05.2014

example like this?

pawn Код:
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    new players;
    for (new i; i < MAX_PLAYERS; i++)
    {
    if (gTeam[i] != dini_Int(pFile(playerid),"nameoffaction")) players++;
    {
    //ocean
    if(areaid == oceanRect)
    {
        UnderAttack[ocean] = 0;
        capturedrecently[ocean] = 1;
        GangZoneStopFlashForAll(Zone[ocean]);
        KillTimer(timer[playerid][ocean]);
    }