[Tutorial] How do GangZones work
#1

Introduction
Hello fellow learners (or [HiC]TheKiller):b
When I was learning pawno, or when I was trying to understand it I was blind with GangZones.
So with this tutorial I'll try and give my best to help you.
Gangzones
GangZoneCreate has the following parameters:
  • min_x //This will be the min x float the player can go, that will be the west side.
  • min_y //This will be the min y float the player can go, that will be the south side.
  • max_x //This will be the max x float the player can go, that will be the east side.
  • max_y //This will be the max x float the player can go, that will be the north side.
Go in game and save the positions you want.
Here is a little tip:

Original source: https://sampwiki.blast.hk/wiki/SetPlayerFacingAngle
But first of all we need to create the variable of the gangzone we want to create.
So lets try for example grove.
Some where in your script, not under any function, do this:
pawn Код:
new grovezone;//This will be where we will store the created gangzone id.
Creating it
Open your documents and open the text file called savedpositions.txt
And for example you have these coords saved:
Quote:

AddPlayerClass(120,2220.3711,1372.5238,7.1953,1.95 97,0,0,0,0,0,0); // minx
AddPlayerClass(120,-2620.6538,-1937.0173,7.1875,97.2865,0,0,0,0,0,0); // miny
AddPlayerClass(120,2737.8306,1300.1874,12.6532,186 .6597,0,0,0,0,0,0); // maxx
AddPlayerClass(120,-2577.2681,-1372.4310,7.1875,352.5596,0,0,0,0,0,0); // maxy

So all you want from those are:
Quote:

AddPlayerClass(120,2220.3711,1372.5238,7.1953,1.9597,0,0,0,0,0,0); // minx
AddPlayerClass(120,-2620.6538,-1937.0173,7.1875,97.2865,0,0,0,0,0,0); // miny
AddPlayerClass(120,2737.8306,1300.1874,12.6532,186.6597,0,0,0,0,0,0); // maxx
AddPlayerClass(120,-2577.2681,-1372.4310,7.1875,352.5596,0,0,0,0,0,0); // maxy

If you copy the "more black painted" ones you should have this:
2220.3711,-1937.0173,2737.8306,-1372.4310
Float:Minx, Float:Miny, Float:Maxx, Float:MaxY
Because the floats of sa-mp are:
Float:X,Float:Y,Float:Z.
And AddPlayerClass is:
AddPlayerClass(skinid,Float:X,Float:Y,Float:Z,Floa t:Angle,Weapon1,Weapon1_ammo,Weapon2,Weapon2_ammo, Weapon3,Weapon3_ammo);
But for this we only want the Float and Float:y.
So under OnGameModeInit or if your creating a filterscript OnFilterscriptInit
Add this:
pawn Код:
grovezone = GangZoneCreate(2220.3711,-1937.0173,2737.8306,-1372.4310);//Storing the created gangzone id in the "grovezone" variable.
Showing it
Well showing it, is very easy.
I normally put it under OnPlayerConnect.
GangZoneShowForPlayer has the following parameters:
  • playerid
  • zone id
  • color of the zone
GangZoneShowForPlayer(playerid,zone id, color);
So we can do this:
pawn Код:
public OnPlayerConnect(playerid)
{
GangZoneShowForPlayer(playerid,grovezone,0x00C714A A);//Showing the gangzone "grovezone" with a light green color.
return 1;
}
If you have any questions, feel free to ask.
Please don't start a war on me.
Reply
#2

Thank you. My biggest problem is, that I can't figure how to be able to start wars using gangzones.
Reply
#3

Quote:
Originally Posted by persious
Посмотреть сообщение
Thank you. My biggest problem is, that I can't figure how to be able to start wars using gangzones.
Lol no problem.
Well use some functions like isPlayerInArea and that.
Reply
#4

Yeah, but I started using PAWN 2 day's ago, and it's just confusing as shit :P
Reply
#5

For getting coordinates, its better to use iPLEOMAX app
Reply
#6

There are already a tools , and Fs's that uses this methode in a EASY WAY, for people who's lazzy to go in game and /save in each angle, and so, but good work... for newbies.
Reply
#7

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
There are already a tools , and Fs's that uses this methode in a EASY WAY, for people who's lazzy to go in game and /save in each angle, and so, but good work... for newbies.
You're always against my tutorials and releases.
Don't comment at all!
Reply
#8

Thank you FireCat! This one really helps. But I have a question.. The GangZoneCreate thingie shows like a box?
Reply
#9

Quote:
Originally Posted by Ehab1911
Посмотреть сообщение
Thank you FireCat! This one really helps. But I have a question.. The GangZoneCreate thingie shows like a box?
Yes.
It's not possible to create has a circle
Reply
#10

Yes it is...
Reply
#11

Quote:
Originally Posted by Vukilore
View Post
Yes it is...
Show me then.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)