SA-MP Forums Archive
Two people capturing? - 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: Two people capturing? (/showthread.php?tid=451696)



Two people capturing? - JimmyCh - 18.07.2013

Hi guys, so I made some capture zones for my server but I'm having one problem.
If you go capture it and the timer is running, if someone from your team walks into the capturing checkpoint too, he will capture aswell.
What I mean is, it will be captured twice by the same team.

What I want is, how can I make it give an error:Your team is already capturing this zone?
But if it can be made somehow so both capture the same zone on the same timer, it would be better.
Here is a sample of OnPlayerEnterDynamicCP:
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CP[CityHall])
    {
        if(UnderAttack[CityHall] == 0) {
            if(tCP[CityHall] != gTeam[playerid]) {
                CountVar[playerid][CityHall] = 25;
                ActiveCityHall(playerid);
            } else return SendClientMessage(playerid, COLOR_RED,"*This zone is already captured by your team!");
        } else return CaptureZoneMessage(playerid, 2);
    }
}
Hope you can help me!


Re: Two people capturing? - JimmyCh - 18.07.2013

Bump..


Re: Two people capturing? - mahdi499 - 18.07.2013

i beleive you can add global variable called
pawn Код:
new BeingCaptured;
and When someone starts capturing set the variable value to 1 and when he is done from capturing it goes to 0,and add another statment in your code
pawn Код:
if(BeingCaptured == 1) return SendClientMessage(playerid, -1,"Someone is already capturing!");
hope this helped


Re: Two people capturing? - x96664 - 18.07.2013

OFF: I suggest you to reduce the capture time if there are 2 or more players in the same checkpoint.


Re: Two people capturing? - JimmyCh - 18.07.2013

Anyway how can I make it that if another player comes to the zone, it becomes half the time to capture it? Using that BeingCaptured?
Anyway I will try it.


Re: Two people capturing? - JimmyCh - 18.07.2013

Guys, if I wanna make it that if your team is capturing and you enter the zone, you capture the same zone with him, how do I do that? I tried but failed.. It would be great to tell me how


Re: Two people capturing? - JimmyCh - 18.07.2013

@madhi, this worked, thanks alot(Gonna rep+ when I can coz i already gave 3 reps)
But if u can help with the above, would be nicer ^^


Re: Two people capturing? - JimmyCh - 19.07.2013

Guys, so somehow it got fixed, i have no idea how, that BeingCaptured made it worse but anyway its all fixed now
but Im having one problem
if ur team is capturing and u enter it, it says its under attack, but if u exit it, it stops the other guy from capturing it.. even if hes still in it.