05.10.2011, 13:21
(
Последний раз редактировалось FireCat; 11.11.2012 в 18:00.
)
Introduction
Hello fellow learners (or [HiC]TheKiller):bWhen 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.
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.txtAnd 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 |
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 |
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

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
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;
}
Please don't start a war on me.