SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 13/12/2015, 09:31 PM   #21
N0FeaR
High-roller
 
N0FeaR's Avatar
 
Join Date: Nov 2011
Location: Los Santos, Idlewood
Posts: 2,347
Reputation: 152
Default Re: [New] How to make capture zone system (no more code repeating)

Thanks, i love it!
__________________
Check out this sh*t

N0FeaR is offline   Reply With Quote
Old 03/01/2016, 11:27 PM   #22
Counterafk
Big Clucker
 
Join Date: Mar 2012
Posts: 76
Reputation: 1
Default Re: [New] How to make capture zone system (no more code repeating)

Could someone please explain
Code:
new const gCaptureZone[][e_CAPTURE_ZONE] =
{
	{"Big Ear", {-437.5,1513.671875, -244.140625,1636.71875}, {-311.0136,1542.9733,75.5625}, 0},
	{"Area 51", {-46.875,1697.265625, 423.828125,2115.234375}, {254.4592,1802.8997,7.4285}, 1}
};
To me it looks like {X,Y, X,Y} {X,Y, X,Y,?}

Am I supposed to go like this? I'm really lost
Counterafk is offline   Reply With Quote
Old 04/01/2016, 03:54 AM   #23
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,736
Reputation: 789
Default Re: [New] How to make capture zone system (no more code repeating)

Quote:
There are 4 things we need to fill into the array for a new capture zone. These 4 are:
  • Zone name
  • Gangzone coordinate (minx, miny, maxx, maxy)
  • Checkpoint coordinate (x, y, z)
  • The teamid which will be the initial owner of the zone
Here is the syntax:
Code:
{"zone_name", {minx, miny, maxx, maxy}, {cpx, cpy, cpz}, teamid}

{minx, miny, maxx, maxy} for gangzone coordinates.
{cpx, cpy, cpz} for checkpoint coordinates.
__________________
Gammix is offline   Reply With Quote
Old 04/01/2016, 06:34 AM   #24
CrunchxNoy
Little Clucker
 
CrunchxNoy's Avatar
 
Join Date: Nov 2015
Posts: 35
Reputation: 1
Default Re: [New] How to make capture zone system (no more code repeating)

WOW Thanks You Gammix !
__________________
CrunchXnoy
CrunchxNoy is offline   Reply With Quote
Old 04/01/2016, 02:43 PM   #25
Counterafk
Big Clucker
 
Join Date: Mar 2012
Posts: 76
Reputation: 1
Default Re: [New] How to make capture zone system (no more code repeating)

Quote:
Originally Posted by Gammix View Post
Here is the syntax:
Code:
{"zone_name", {minx, miny, maxx, maxy}, {cpx, cpy, cpz}, teamid}

{minx, miny, maxx, maxy} for gangzone coordinates.
{cpx, cpy, cpz} for checkpoint coordinates.
Wow. Cant believe I missed that in the original post, thanks alot though man!
Counterafk is offline   Reply With Quote
Old 04/01/2016, 03:42 PM   #26
aloveliday
Little Clucker
 
Join Date: Dec 2015
Posts: 7
Reputation: 0
Default Re: [New] How to make capture zone system (no more code repeating)

Gammix your script looks like awesome but i am very newbie about pawno so i did not understand what you explained about.

Could you complete the blanks with true numbers and names to be more specific?
I mean i need more detail i did not make it.

I just need an example script with fake number and coordinate zone names and other names.Please
aloveliday is offline   Reply With Quote
Old 05/01/2016, 09:04 AM   #27
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,736
Reputation: 789
Default Re: [New] How to make capture zone system (no more code repeating)

Quote:
Originally Posted by aloveliday View Post
Gammix your script looks like awesome but i am very newbie about pawno so i did not understand what you explained about.

Could you complete the blanks with true numbers and names to be more specific?
I mean i need more detail i did not make it.

I just need an example script with fake number and coordinate zone names and other names.Please
Explanation is given in FAQ. But here i'll try a bit harder.


This array hods team's information. The first param is the team's name and the second is its color.
Syntax:
Code:
{"team_name", team_color}

Example:
Code:
new const gTeamData[][e_TEAM_DATA] = 
{
	{"Germany", 0xFFFF90FF}
};
The thing to keep in mind is you use the same index (here "Germany" is at 0) as teamid, so germany should be:
Code:
SetPlayerTeam(playerid, 0);


Secondly, the capture zone array:
You can add as many you want, just take care of the syntax only.
Syntax:
Code:
{"zone_name", {minx, miny, maxx, maxy}, {cpx, cpy, cpz}, zone_owner_team}

Keep in mind that zone_owner_team must be an existing index from gTeamData. Like germany is 0 so if you put 0 as zone_owner_team, then basically you are setting germany as the default owner of the zone.

Example:
Code:
new const gCaptureZone[][e_CAPTURE_ZONE] =
{
	{"Big Ear", {-437.5,1513.671875, -244.140625,1636.71875}, {-311.0136,1542.9733,75.5625}, 0}
};

So we can create our sample (2 teams and 1 capture zone):
Code:
new const gTeamData[][e_TEAM_DATA] = 
{
	{"Germany", 0xFFFF90FF},
	{"India", 0xFF90FFFF},
};

new const gCaptureZone[][e_CAPTURE_ZONE] =
{
	{"Big Ear", {-437.5,1513.671875, -244.140625,1636.71875}, {-311.0136,1542.9733,75.5625}, 0}
};

You can also check the Sample(pastebin link) from main page.
__________________
Gammix is offline   Reply With Quote
Old 16/03/2016, 02:35 AM   #28
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 705
Reputation: 46
Default Re: [New] How to make capture zone system (no more code repeating)

How do I make the zone unowned at start?

Thanks!
stormchaser206 is offline   Reply With Quote
Old 16/03/2016, 02:47 AM   #29
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,736
Reputation: 789
Default Re: [New] How to make capture zone system (no more code repeating)

Quote:
Originally Posted by stormchaser206 View Post
How do I make the zone unowned at start?

Thanks!
Its easy by creating a new team at the last index of your teams array.

Example:
Code:
new const gTeamData[][e_TEAM_DATA] = 
{
	{"Germany", 0xFFFF90FF},
	{"India", 0xFF90FFFF},
	{"Unknown Team", 0x505050FF} // This is the last index i.e. 2
};

new const gCaptureZone[][e_CAPTURE_ZONE] =
{
	{"Big Ear", {-437.5,1513.671875, -244.140625,1636.71875}, {-311.0136,1542.9733,75.5625}, 2} // Set the team id to 2
};

But if you don't want the system to print messages for unknown team, just edit the SendClientMessageToAll parts where team names are used.
__________________
Gammix is offline   Reply With Quote
Old 16/03/2016, 09:51 PM   #30
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 705
Reputation: 46
Default Re: [New] How to make capture zone system (no more code repeating)

Quote:
Originally Posted by Gammix View Post
Its easy by creating a new team at the last index of your teams array.

Example:
Code:
new const gTeamData[][e_TEAM_DATA] = 
{
	{"Germany", 0xFFFF90FF},
	{"India", 0xFF90FFFF},
	{"Unknown Team", 0x505050FF} // This is the last index i.e. 2
};

new const gCaptureZone[][e_CAPTURE_ZONE] =
{
	{"Big Ear", {-437.5,1513.671875, -244.140625,1636.71875}, {-311.0136,1542.9733,75.5625}, 2} // Set the team id to 2
};

But if you don't want the system to print messages for unknown team, just edit the SendClientMessageToAll parts where team names are used.
Thanks!

Also, the zone area does not show up for me on the map. Only the flag (when I get near) and the checkpoint. Also, the checkpoint is useless, it doesn't do anything, except send a message saying that it will be captured in 30 seconds. I can wait five minutes and nothing happens.

Code for enum:


OnGamemodeInit


OnPlayerConnect


There is also no progress bar.
stormchaser206 is offline   Reply With Quote
Reply

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
[Help] Capture zone dieegov Scripting Help 0 15/07/2013 10:22 PM
Capture Zone [HELP] [REP+] Pravin Scripting Help 0 02/08/2012 04:11 PM
Lots of errors with zone capture system stormchaser206 Scripting Help 16 15/07/2012 07:11 PM
Capture Zone [WTF]Godfather Scripting Help 4 17/05/2012 05:10 AM
Make This Zone Code Takable? <Weponz> Help Archive 0 25/10/2010 12:59 PM


All times are GMT. The time now is 02:21 AM.


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