SA-MP Forums Archive
Need Small Help with Zones - 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: Need Small Help with Zones (/showthread.php?tid=353055)



Need Small Help with Zones - Jarnu - 22.06.2012

I made a small Capture Zone system. The Script:-
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
   if(checkpointid == CP)
    {
      SendClientMessage(playerid, COLOR_RED,"You're capturing this zone! You Need to wait 30 Seconds");
      GangZoneFlashForAll(GangZone, COLOR_PINK);
      Capture = SetTimer("Check",30000,1);
    }
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
   if(checkpointid == CP)
    {
      SendClientMessage(playerid, COLOR_RED,"You have Failed to Take over the Zone!");
      GangZoneStopFlashForAll(GangZone);
      KillTimer(Capture);
    }
    else
    {
    KillTimer(Capture);
    }

forward Check(playerid);
public Check(playerid)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+5 );
GivePlayerMoney(playerid, 500);
SendClientMessage(playerid, COLOR_BLUE,"You've capture the zone and receive 500 $ and 5 score");
GangZoneStopFlashForAll(GangZone);
if(gTeam[playerid] == TEAM_IRAQ)
{
GangZoneShowForAll(GangZone, COLOR_IRAQ);
}
else if(gTeam[playerid] == TEAM_INDIA)
{
GangZoneShowForAll(GangZone, COLOR_INDIA);
}
else if(gTeam[playerid] == TEAM_BANGLADESH)
{
GangZoneShowForAll(GangZone, COLOR_BANGLADESH);
}
else if(gTeam[playerid] == TEAM_PAKISTAN)
{
GangZoneShowForAll(GangZone, COLOR_PAKISTAN);
}
else if(gTeam[playerid] == TEAM_GERMANY)
{
GangZoneShowForAll(GangZone, COLOR_GERMANY);
}
else if(gTeam[playerid] == TEAM_HOLLAND)
{
GangZoneShowForAll(GangZone, COLOR_HOLLAND);
}
else if(gTeam[playerid] == TEAM_USA)
{
GangZoneShowForAll(GangZone, COLOR_USA);
}
else if(gTeam[playerid] == TEAM_UK)
{
GangZoneShowForAll(GangZone, COLOR_UK);
}
else if(gTeam[playerid] == TEAM_INDONESIA)
{
GangZoneShowForAll(GangZone, COLOR_INDONESIA);
}
else if(gTeam[playerid] == TEAM_CHINA)
{
GangZoneShowForAll(GangZone, COLOR_CHINA);
}
return 1;
}
Now i want to Prevent player to re-capture the zone .. and will give error that its already captured by his team.. how to do that? and how to add more capture zones in it?


Re: Need Small Help with Zones - [MM]RoXoR[FS] - 22.06.2012

pawn Код:
new cZone[20]=-1;
Now, when a team captures a zone.
pawn Код:
cZone[GangZone] = TEAM_PAKISTAN;
Now when a player of team enter checkpoint
pawn Код:
if(gTeam[playerid] == cZone[GangZone]) return SendClientMessage(playerid,0xFFFFFF,"This zone is of your team.");
Search before posting.