SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 20/08/2011, 10:16 AM   #1
Admigo
High-roller
 
Admigo's Avatar
 
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,840
Reputation: 297
Default How can i make capture zones with timer?

Heey guys,
I want to make capture zones with pickup not with checkpoint.
You need to stay 20 seconds in pickup or in range to capure the zone but i dont know how.
I made the teams with gTeam[playerid].
Pls help me.
__________________
Follow me on Instagram @brandonvanommen
Admigo is offline  
Old 20/08/2011, 01:12 PM   #2
Admigo
High-roller
 
Admigo's Avatar
 
Join Date: Oct 2010
Location: The Netherlands
Posts: 1,840
Reputation: 297
Default Re: How can i make capture zones with timer?

I made this:
Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid==areap&& gTeam[playerid]==TEAM_EUROPE && europecapture ==0)
	{
		areatimer=SetTimer("count1",1000,1);
		europetaken=1;
		ShowProgressBarForPlayer(playerid,capture);
	}
	if(pickupid==areap && gTeam[playerid]==TEAM_EUROPE && europecapture ==1)
	{
		SendClientMessage(playerid,red,"Your team already has Area51!");
		HideProgressBarForPlayer(playerid,capture);
	}
	if(pickupid==oldairportp && gTeam[playerid]==TEAM_EUROPE && europecapture ==0)
	{
		oldairporttimer=SetTimer("count2",1000,1);
		europetaken=1;
		ShowProgressBarForPlayer(playerid,capture);
	}
	if(pickupid==oldairportp && gTeam[playerid]==TEAM_EUROPE && europecapture ==1)
	{
		SendClientMessage(playerid,red,"Your team already has Old Airport!");
		HideProgressBarForPlayer(playerid,capture);
	}

	return 1;
}
And the Timers:
Code:
forward count1(playerid);
public count1(playerid)
{
//new string[56];
counter++;
SetProgressBarValue(capture, counter);
SetProgressBarMaxValue(capture, 20);
UpdateProgressBar(capture, playerid);
//format(string, sizeof(string),"~r~Wait %d seconds to capture Area51!!",counter);
//GameTextForAll(string,1000,5);
if(counter==20)
{
	if(europetaken==1)
	{
			GangZoneShowForAll( area, GZ_YELLOW);
   			SetPlayerScore(playerid,GetPlayerScore(playerid)+4);
   			GiveTeamScore(gTeam[playerid]=TEAM_EUROPE, 1);
			SendClientMessage(playerid,COLOR_WHITE,"You received 5 score and 6000 Dollar for capturing Area59!");
			if(playerid)
			{
			SendTeamMessage(COLOR_WHITE, "",TEAM_EUROPE);
			}
			SendTeamMessage(COLOR_WHITE, "You received 1 Score For a Capture!",TEAM_EUROPE);
			GivePlayerMoney(playerid,6000);
			europecapture=1;
   			usacapture=0;
   			//japancapture=0;
   			//russiacapture=0;
   			//afghancapture=0;
			capturedzones[playerid]++;
			HideProgressBarForPlayer(playerid,capture);
			KillTimer(areatimer);
	}
	if(usataken==1)
	{
			GangZoneShowForAll( area, GZ_LIGHTBLUE);
   			SetPlayerScore(playerid,GetPlayerScore(playerid)+4);
            GiveTeamScore(gTeam[playerid]=TEAM_EUROPE, 1);
			europecapture=0;
   			usacapture=1;
   			//japancapture=0;
   			//russiacapture=0;
   			//afghancapture=0;
			capturedzones[playerid]++;
			KillTimer(areatimer);
	}
	if(japantaken==1)
	{
			GangZoneShowForAll( area, GZ_DARKRED);
   			SetPlayerScore(playerid,GetPlayerScore(playerid)+4);
            GiveTeamScore(gTeam[playerid]=TEAM_JAPAN, 1);
			europecapture=0;
   			usacapture=0;
   			//japancapture=1;
   			//russiacapture=0;
   			//afghancapture=0;
			capturedzones[playerid]++;
			KillTimer(areatimer);
	}
	if(russiataken==1)
	{
			GangZoneShowForAll( area, GZ_PINK);
   			SetPlayerScore(playerid,GetPlayerScore(playerid)+4);
            GiveTeamScore(gTeam[playerid]=TEAM_RUSSIA, 1);
			europecapture=0;
   			usacapture=0;
   			//japancapture=0;
   			//russiacapture=1;
   			//afghancapture=0;
			capturedzones[playerid]++;
			KillTimer(areatimer);
	}
	if(afghantaken==1)
	{
			GangZoneShowForAll( area, GZ_WHITE);
   			SetPlayerScore(playerid,GetPlayerScore(playerid)+4);
            GiveTeamScore(gTeam[playerid]=TEAM_AFGHAN, 1);
   			//afghancapture=1;
			europecapture=0;
   			usacapture=0;
   			//japancapture=0;
   			//russiacapture=0;
			capturedzones[playerid]++;
			KillTimer(areatimer);
	}
	counter=20;
	HideProgressBarForPlayer(playerid, capture);
	if(counter>0 && counter<20)
	{
		if(europetaken==1&& !IsPlayerInRangeOfPoint(playerid,2.0,214.7506,1822.6283,6.4141))
		{
		    KillTimer(areatimer);
		    HideProgressBarForPlayer(playerid,capture);
		}
	}
}
The other timer is the same but only the range and the gangzones are dfferent.
Now if i capture one i cant take the other.
Pls can anyone help me making capture zones?
__________________
Follow me on Instagram @brandonvanommen
Admigo is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make timer gives little bit hp? the_zande Help Archive 2 24/04/2011 11:37 PM
[HELP] /robbank Timer, how can i make one? marszim Help Archive 11 07/01/2010 12:03 PM
[HELP] how i make a timer? jordylol6 Help Archive 2 05/01/2010 04:33 PM
[HELP] How can i make a timer on my /heal cmd rp4life Help Archive 1 24/02/2009 02:58 PM


All times are GMT. The time now is 08:57 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.