Small problem
#1

Hello guys my buddy SickAttack helped me make capture zones but i cant get how to check if the capture zone was catched already by the team so it will not let the team that captured it capture it again untill it got catched by another team here is my code

pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == Checkpoints[0])
    {
        SendClientMessage(playerid, COLOR_ORANGE, "Wait 30 seconds to capture this zone.");
        SendClientMessageToAll(COLOR_ORANGE, "Zone one is being captured!");
        GangZoneFlashForAll(CaptureZoneOne, 0xFF000099);
        CaptureTime = SetTimerEx("SetCapturedZone", 30000, false, "i", playerid);
        return 1;
    }  
   return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    if(checkpointid == Checkpoints[0])
    {
        SendClientMessage(playerid, COLOR_ORANGE, "You left the checkpoint, the capture has been cancelled.");
        SendClientMessageToAll(COLOR_ORANGE, "Zone one has failed to be captured!");
        GangZoneStopFlashForAll(CaptureZoneOne);
        KillTimer(CaptureTime);
        return 1;
    }
   return 1;
}

forward SetCapturedZone(playerid);
public SetCapturedZone(playerid)
{
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
    GivePlayerMoney(playerid, 50000);
    GangZoneStopFlashForAll(CaptureZoneOne);
    SendClientMessage(playerid, COLOR_ORANGE, "You have captured zone one and received 5 score & $50,000!");
    KillTimer(CaptureTime);
    if(gTeam[playerid] == Team_Gang)
    {
       GangZoneShowForAll(CaptureZoneOne,GetPlayerColor(playerid));
    }  
    return 1;
}

Any help will be appriciated
Reply
#2

Variables.
pawn Код:
new Zone1Cap;

//OnGameModeInIt
    SetTimer("PlayerOneSecondVariables",1000,1);

//then under the captured zone, or after capturing the zone.
Zone1Cap =300; //300 seconds for example

//then under when someone is trying to capture the zone
if(Zone1Cap > 1) return SendClientMessage(playerid, COLOR_RED,"this zone has been captured lately.");

//Then for the one second timer.
forward PlayerOneSecondVariables();
public PlayerOneSecondVariables()
{
    for(new i=0; i<MAX_PLAYERS; i++)
        {
           if(Zone1Cap > 1)
          {
              Zone1Cap --;
          }
       }
  return 1;
}
hope that helped.
Reply
#3

That code is'nt dynamic meaning you can't add any more zones unless you make a new foward everytime, I Wouldn't recommend you use that, It would lag your script with 10+ zones...
Reply
#4

i didnt say that i want more zones i said if a team has captured the place then the team that captured it already cant capture again for exsample Team_gang got the capture zone,someone from team gang is going to the capture zone and it shows him this capture zone is already captured by your team how do i do that?
Reply
#5

my code does what you want.
Reply
#6

How do i detect that a team captures it ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)