[Include] GZ Shapes - gang zone shapes on the map
#1

GZ Shapes v0.01


[*] Introduction
Hello, this is a little include I scripted some weeks ago in order to help a friend to create circles on the game's map, after messing around a little bit I came out with this. Circles are not as cool as those from GTA IV but you might accomplish some nice things with this, for example: zones for mini-missions, zones where something spawns randomly, etc.


[*] Screenshots

Circles
Empty Circles
Circumferences

[*] Video
Here you can find a video.


[*] Download
Get it now from GitHub!

ALS and YSI versions available. If you don't know what YSI is, get the ALS version.


[*] Documentation
I must write the documentation, meanwhile here you have some info about the functions:
Код:
GZ_ShapeCreate(GZ_SHAPE_TYPES:type, Float:x, Float:y, Float:radius, squares = -1, Float:square_size = 5.0, Float:min_ang = 0.0, Float:max_ang = 360.0)

type               -> the shape's form (CIRCLE, EMPTY_CIRCLE, CIRCUMFERENCE).
Float:x            -> the X position of the shape's center.
Float:y            -> the Y position of the shape's center.
Float:radius       -> the radius of the shape.
squares            -> the amount of gang zones used for the shape (-1 for auto amount).
Float:square_size  -> represents how big are going to be the gang zones created for the circumference (5.0 looks smooth).
min_angle          -> represents the angle where the draw of the shape will start (by default 0.0).
max_angle          -> represents the angle where the draw of the shape will finish (by default 360.0).

Returns: a gang zone shape ID or INVALID_GZ_SHAPE_ID.
The remaining functions are similar to the default gang zones functions and can be used with any shape form:
Код:
GZ_ShapeDestroy(shapeid)
GZ_ShapeDestroyAll()

GZ_ShapeShowForPlayer(playerid, shapeid, color)
GZ_ShapeHideForPlayer(playerid, shapeid)

GZ_ShapeShowForAll(shapeid, color)
GZ_ShapeHideForAll(shapeid)

GZ_ShapeFlashForPlayer(playerid, shapeid, flashcolor)
GZ_ShapeStopFlashForPlayer(playerid, shapeid)

GZ_ShapeFlashForAll(shapeid, flashcolor)
GZ_ShapeStopFlashForAll(shapeid)
[*] Limits
I'm aware about the SA-MP limits, as you know gang zones cannot be streamed, so watch out! By default this include allows a max. of 10 shapes created at once (MAX_GZ_SHAPES). That doesn't mean you can create 10 huge circles with an automatic amount of squares, that would exceed the gang zones limit. A circle might use all the gang zones available if you wish (1024) but you won't be able to create more.

This include counts how many gang zones have been created with it and when the limit is reached it won't allow you to create new circles. But be careful, if you create simple gang zones on filterscripts or in your gamemode the include won't count them!

These notes might help you out when creating shapes:
  • If you specify the amount of squares you want to use for a circumference and the radio is relatively large you'll get spaces between squares (dashed line).
  • The min_angle and max_angle parameters allow you to create semicircumferences or other curves.
  • If the square_size parameter is too high the circumference gets a "pixelated" effect, smaller values produce smoother drawings, 5.0 looks fine to me.
  • If you want to create a circumference with a continuous draw line and you use a low value for the square_size parameter, it will require more gang zones, so you must increase the squares parameter.
[*] Other
Thank you for reading my thread, if you want to support what I do you might buy me a coffe! Join to my Discord server if you want to follow the development of my gamemode.

If you find any bug, please let me know.

Best regards.
Reply
#2

Very nice!

I put gz circles in my future pubg gamemode, too.

Reply
#3

Quote:
Originally Posted by RogerCosta
Посмотреть сообщение
Very nice!

I put gz circles in my future pubg gamemode, too.

Nice include. Can you show me the code how you made everything red except the area in the circle?
Reply
#4

Looks good. I was about to make a comment about PUBG too but PatrickGTR already made that lol.
Reply
#5

Nice release!
Reply
#6

Waiting for PUBG servers.
Reply
#7

Quote:
Originally Posted by Escobabe
Посмотреть сообщение
Waiting for PUBG servers.
There is a PUBG server named "San Andreas Battlegrounds" already, but it's in the Russian language. It's pretty easy to manage to get in-game though.
Reply
#8

Quote:
Originally Posted by cuber
Посмотреть сообщение
There is a PUBG server named "San Andreas Battlegrounds" already, but it's in the Russian language. It's pretty easy to manage to get in-game though.
Would you be so kind and send me the IP via pm?
Reply
#9

Quote:
Originally Posted by JustMe.77
Посмотреть сообщение
Would you be so kind and send me the IP via pm?
Sure.
Reply
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
Nice. But:



Why? I assume by this you mean y_hooks, which is only one part of YSI. However, y_hooks code is entirely compatible with ALS, so if you already have an ALS version there is no need at all for a y_hooks version - even YSI uses a combination of both internally (though most of those ALS hooks are ensuring y_hooks works).

The point of y_hooks is to write less code than ALS (it's also faster). If you've already gone to the trouble of writing all the ALS boilerplate, there's no point using y_hooks. You will end up writing more code to use y_hooks than you would if you just stuck with the single long version.
Yes, y_hooks is one of the reasons, but I'd like just to add iterators to iter throught all the gang zones a shape has, when showing/hiding/destroying them. I guess this way I don't have to check valid (or not) array cells.
Reply
#11

nice
Reply
#12

Very cool.
Reply
#13

Quote:
Originally Posted by RogerCosta
Посмотреть сообщение
Very nice!

I put gz circles in my future pubg gamemode, too.

Can you tell me how to make everything red except in the middle?
Reply
#14

Awesome ! nice works guys !
Reply
#15

Nice bro, thanks

+REP
Reply
#16

Quote:
Originally Posted by ohmy
Посмотреть сообщение
Can you tell me how to make everything red except in the middle?
There is a picture and a function right under it.

For this you'll need EMPTY_CIRCLE as the first parameter
Код:
GZ_ShapeCreate(EMPTY_CIRCLE, Float:x, Float:y, Float:radius, squares = -1, Float:square_size = 5.0, Float:min_ang = 0.0, Float:max_ang = 360.0)
Reply
#17

Is there any possible way to detect if the player is outside those zones or detecting them if they are inside those?
Reply
#18

yes you take center point of this circle and if player distance is bigger then circle radius, player is out of circle and when same or smaller then inside circle.
Reply
#19

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
Is there any possible way to detect if the player is outside those zones or detecting them if they are inside those?
Yes.

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
yes you take center point of this circle and if player distance is bigger then circle radius, player is out of circle and when same or smaller then inside circle.
That's not the greatest idea when you can use Streamer.
Reply
#20

Alright, I have created a gang-shape zone for safe zone (Circumferences Type), a gang-shape zone for radiation (empty circle type) and a safe zone (Dyanmic Circle created by Streamer to detect if player is inside/outside the safe zone).

Now how do I detect if the player is inside/outside the radiation?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)