[Include] Dynamic circles (TextDraw, Object, 3D Label, Pickup, Map icon)
#1

General:

These includes allow you to create various circles and use them for anything you like.

Pictures and Videos:

TextDraw circles:
[ame]http://www.youtube.com/watch?v=R33tp3hN3lE[/ame]

Object circles:


3D Label circles:


Pickup circles:


Map icon circles:




Credits and Required files:

- Incognito for streamer plugin,
- ****** for foreach/iterator include.



Functions and Callbacks:

TextDraw circles:
Код:
// c_textdraw.inc

// Definitions.
#define TD_CIRCLE_TIMER_INTERVAL (100) // Timer interval in miliseconds for auto-timer.

// Callbacks.
forward OnPlayerCircleFinish(playerid); // Called when the color movement of the textdraw circle is at the end (last slot).

// Functions.
TD_CreateCircle(playerid, text[], color, Float:x_pos, Float:y_pos, Float:radius, Float:diff);
TD_DestroyCircle(playerid, bool:loop = false);
TD_IsCircleCreated(playerid); // Returns the number of textdraws created for the player circle.
TD_ActivateCircle(playerid, color, speed); // Default auto-timer interval is 100 miliseconds (the bigger the "speed" parameter is, the slower is color movement of the textdraw circle (watch the video). If you set the "color" parameter to "-1", it will generate random colors (again - watch the video).
TD_StopCircle(playerid); // Will reset (stop) the color movement of the textdraw circle.
TD_ResumeCircle(playerid); // Will resume the color movement of the textdraw circle if the circle was paused.
TD_PauseCircle(playerid); // Will pause the color movement of the textdraw circle.
TD_SetCircleSlotColor(playerid, slot, color); // Use "TD_IsCircleCreated" function to make sure not to cross the maximum slot.
Object circles:
Код:
// c_object.inc

// Definitions.
#define MAX_OBJECT_CIRCLES (20)

// Functions.
Object_CreateCircle(model, Float:x_pos, Float:y_pos, Float:z_pos, Float:x_rot, Float:y_rot, Float:z_rot, Float:radius, Float:diff, world = -1, interior = -1, Float:d_stream = 200.0, Float:d_draw = 0.0); // Returns dynamic circle ID.
Object_DestroyCircle(c_id);
Object_SetCircleTexture(c_id, m_index, txd_model, txd_name[], texture_name[], m_color = 0);
Object_SetCircleObjectTexture(c_id, slot, m_index, txd_model, txd_name[], texture_name[], m_color = 0);
Object_SetCircleModel(c_id, model, Float:radius, Float:diff);
Object_GetCircleModel(c_id);
Float:Object_GetCircleRadius(c_id);
Float:Object_GetCircleDiff(c_id);
Object_SetCirclePos(c_id, Float:x_pos, Float:y_pos, Float:z_pos);
Object_GetCirclePos(c_id, &Float:x_pos, &Float:y_pos, &Float:z_pos);
Object_SetCircleRot(c_id, Float:x_rot, Float:y_rot, Float:z_rot);
Object_GetCircleRot(c_id, &Float:x_rot, &Float:y_rot, &Float:z_rot);
Object_SetCircleStreamDistance(c_id, Float:d_stream);
Float:Object_GetCircleStreamDistance(c_id);
Object_SetCircleDrawDistance(c_id, Float:d_draw);
Float:Object_GetCircleDrawDistance(c_id);
Object_SetCircleWorld(c_id, world);
Object_GetCircleWorld(c_id);
Object_SetCircleInterior(c_id, interior);
Object_GetCircleInterior(c_id);
Object_GetCircleCount(c_id);
3D Label circles:
Код:
// c_label.inc

// Definitions.
#define MAX_LABEL_CIRCLES (20)
#define MAX_LABEL_STRING (6)

// Functions.
Label_CreateCircle(text[], color, Float:x_pos, Float:y_pos, Float:z_pos, Float:radius, Float:diff, testlos = 0, world = -1, interior = -1, Float:d_stream = 50.0, Float:d_draw = 0.0); // Returns dynamic circle ID.
Label_DestroyCircle(c_id);
Label_SetCircleRadius(c_id, Float:radius);
Float:Label_GetCircleRadius(c_id);
Label_SetCircleDiff(c_id, Float:diff);
Float:Label_GetCircleDiff(c_id);
Label_SetCirclePos(c_id, Float:x_pos, Float:y_pos, Float:z_pos);
Label_GetCirclePos(c_id, &Float:x_pos, &Float:y_pos, &Float:z_pos);
Label_SetCircleStreamDistance(c_id, Float:d_stream);
Float:Label_GetCircleStreamDistance(c_id);
Label_SetCircleDrawDistance(c_id, Float:d_draw);
Float:Label_GetCircleDrawDistance(c_id);
Label_SetCircleWorld(c_id, world);
Label_GetCircleWorld(c_id);
Label_SetCircleInterior(c_id, interior);
Label_GetCircleInterior(c_id);
Label_SetCircleTestLOS(c_id, testlos);
Label_GetCircleTestLOS(c_id);
Label_GetCircleCount(c_id);
Pickup circles:
Код:
// c_pickup.inc

// Definitions.
#define MAX_PICKUP_CIRCLES (20)

// Functions.
Pickup_CreateCircle(model, type, Float:x_pos, Float:y_pos, Float:z_pos, Float:radius, Float:diff, world = -1, interior = -1, Float:d_stream = 200.0); // Returns dynamic circle ID.
Pickup_DestroyCircle(c_id);
Pickup_SetCircleModel(c_id, model, Float:radius, Float:diff);
Pickup_GetCircleModel(c_id);
Float:Pickup_GetCircleRadius(c_id);
Float:Pickup_GetCircleDiff(c_id);
Pickup_SetCircleType(c_id, type);
Pickup_GetCircleType(c_id);
Pickup_SetCirclePos(c_id, Float:x_pos, Float:y_pos, Float:z_pos);
Pickup_GetCirclePos(c_id, &Float:x_pos, &Float:y_pos, &Float:z_pos);
Pickup_SetCircleStreamDistance(c_id, Float:d_stream);
Float:Pickup_GetCircleStreamDistance(c_id);
Pickup_SetCircleWorld(c_id, world);
Pickup_GetCircleWorld(c_id);
Pickup_SetCircleInterior(c_id, interior);
Pickup_GetCircleInterior(c_id);
Pickup_GetCircleCount(c_id);
Map icon circles:
Код:
// c_mapicon.inc

// Definitions.
#define MAX_MAPICON_CIRCLES (20)

// Functions.
MapIcon_CreateCircle(Float:x_pos, Float:y_pos, Float:z_pos, type, color, Float:radius, Float:diff, world = -1, interior = -1, Float:d_stream = 150.0, style = MAPICON_LOCAL); // Returns dynamic circle ID.
MapIcon_DestroyCircle(c_id);
MapIcon_SetCircleType(c_id, type, Float:radius, Float:diff);
MapIcon_GetCircleType(c_id);
Float:MapIcon_GetCircleRadius(c_id);
Float:MapIcon_GetCircleDiff(c_id);
MapIcon_SetCirclePos(c_id, Float:x_pos, Float:y_pos, Float:z_pos);
MapIcon_GetCirclePos(c_id, &Float:x_pos, &Float:y_pos, &Float:z_pos);
MapIcon_SetCircleStreamDistance(c_id, Float:d_stream);
Float:MapIcon_GetCircleStreamDistance(c_id);
MapIcon_SetCircleWorld(c_id, world);
MapIcon_GetCircleWorld(c_id);
MapIcon_SetCircleInterior(c_id, interior);
MapIcon_GetCircleInterior(c_id);
MapIcon_SetCircleStyle(c_id, style);
MapIcon_GetCircleStyle(c_id);
MapIcon_GetCircleCount(c_id);

"radius" and "diff" parameters:

If you don't know what radius is, then check the Wikipedia page. The "diff" parameter is a "step". 360 degrees represents the full circle, that means you'll have 360/diff items for your circle. The "diff" of 2.0 will give 180 items (example: objects).
Minimum "diff" for the textdraw circles is 1.40625, because textdraws are created on player-level, which means there can be maximum 256 player-textdraws created (360/256 = 1.40625). The functions will correct the "diff" parameter if you try to enter smaller "diff" than the minimum (1.40625). The minimum "diff" parameter for other circles is 1.0, there is also correcting feature in functions making sure the "diff" parameter won't be smaller than 1.0 for non-textdraw circles.



Download:

Reply
#2

Speedometer (textdraw circles).
[ame]http://www.youtube.com/watch?v=p-DuCr2bAqg[/ame]
Reply
#3

del please
Reply
#4

Quote:
Originally Posted by Stuntff
Посмотреть сообщение
del please
Excuse me?
Reply
#5

Quote:
Originally Posted by Correlli
Посмотреть сообщение
Excuse me?
Can you give me cmd that used in the video? I have for some reason does not create a circle ..
Reply
#6

You should post the exemple codes too you used on video.

I like this include nice job my friend!
Reply
#7

Not Bad + REP
Reply
#8

That's great. Good Work!
Reply
#9

Thank you for this!
Very, very useful.
Reply
#10

Wow nice work!
Reply
#11

Very nice!
Reply
#12

@ZaBraNjeNi: "Very very" useful for what purpose ?

I don't really see the usefulness of this include. Maybe for a speedometer as you tried to show us, but I don't really see how we could use your map icons circles. I don't think many people are going to use your include. Anyway if you enjoyed coding it, it matters. Thank you for your contribution.
Reply
#13

@Varkoll_ There is many ways to use this include.... As Corelli was show us with speedometer, I'll use it for my upcoming COD server.
Use your imagination.
Reply
#14

Great!
Example
Reply
#15

@Everyone: Thank you.

Quote:
Originally Posted by Stuntff
Посмотреть сообщение
Can you give me cmd that used in the video? I have for some reason does not create a circle ..
Quote:
Originally Posted by PT
Посмотреть сообщение
You should post the exemple codes too you used on video.
Here are commands for the first video (you'll need ZCMD and sscanf), but unfortunately I didn't save the speedometer codes. I might write them again tomorrow or someone else can try to play with the includes.
Код:
command(create, playerid, params[])
{
	new
			text[6], Float:coord[4];
	if(sscanf(params, "s[6]ffF(320.0)F(240.0)", text, coord[0], coord[1], coord[2], coord[3]))
		return SendClientMessage(playerid, -1, "Correct usage: \"/create [text] [radius] [diff] [x] [y]\"");
	if(!TD_DestroyCircle(playerid))
		TD_CreateCircle(playerid, text, 0x000000FF, coord[2], coord[3], coord[0], coord[1]);
	return true;
}
Код:
command(activate, playerid, params[])
{
	TD_ActivateCircle(playerid, 0x00FFFFFF, strval(params));
	return true;
}
Код:
command(stop, playerid, params[])
{
	TD_StopCircle(playerid);
	return true;
}
Код:
command(destroy, playerid, params[])
{
	TD_DestroyCircle(playerid);
	return true;
}
Код:
command(resume, playerid, params[])
{
	TD_ResumeCircle(playerid);
	return true;
}
Код:
command(pause, playerid, params[])
{
	TD_PauseCircle(playerid);
	return true;
}
Код:
public OnPlayerCircleFinish(playerid)
{
	SendClientMessage(playerid, 0xFFFFFFFF, "Finished!");
	return true;
}
Quote:
Originally Posted by Varkoll_
Посмотреть сообщение
@ZaBraNjeNi: "Very very" useful for what purpose ?

I don't really see the usefulness of this include. Maybe for a speedometer as you tried to show us, but I don't really see how we could use your map icons circles. I don't think many people are going to use your include. Anyway if you enjoyed coding it, it matters. Thank you for your contribution.
Let me first start with pickup circles. One of my favourite games is "The Lord of the Rings: Conquest". You must capture and defend zones from enemies in order to win. Here's an example:


And this in my opinion could be used to mark capturing/defending zone:


Next thing - textdraw circles: another favourite game of mine - The Godfather The Game II:
[ame]http://www.youtube.com/watch?v=WXABMZHBWXI[/ame]
Video shows activity of cracking a safe - you can see the circle moving while the made man is doing an activity (cracking a safe in this case). You can use it in a RP server while the player is cracking the bank safe or while he is loading something or whatever.

Object circles - stunt server comes in mind first.

As for the map icons, I also see an idea to mark an area on the map/radar. This include may not be as useful as others, but I did it anyway.

And finally, like "ZaBraNjeNi" said - use your imagination. It's a beautiful thing.

Quote:
Originally Posted by Levu
Посмотреть сообщение
Not created using this include. It's from a different person.
Reply
#16

Pretty good, another example:

[ame]http://www.youtube.com/watch?v=gqoBEwvH5ak[/ame]
Reply
#17

Very nice work.

Love the circle textdraws
Reply
#18

Good Job Man!!
Reply
#19

How many TextDraws does it use?

It looks interesting and nice!
Reply
#20

Hmmmm ....
Very Usefull With A Circle can Make Anything ....

I Very Like The Textdraw

@Levu How to make that ?
I Want Use that ... Really Nice
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)