PDA

View Full Version : Two people capturing?


JimmyCh
18/07/2013, 07:38 AM
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:

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!

JimmyCh
18/07/2013, 10:22 AM
Bump..

mahdi499
18/07/2013, 10:30 AM
i beleive you can add global variable called

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

if(BeingCaptured == 1) return SendClientMessage(playerid, -1,"Someone is already capturing!");
hope this helped

x96664
18/07/2013, 10:31 AM
OFF: I suggest you to reduce the capture time if there are 2 or more players in the same checkpoint.

JimmyCh
18/07/2013, 11:51 AM
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.

JimmyCh
18/07/2013, 07:06 PM
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 :)

JimmyCh
18/07/2013, 08:22 PM
@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 :) ^^

JimmyCh
19/07/2013, 08:55 AM
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.