SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 27/02/2016, 04:37 PM   #1
Correlli
Godfather
 
Correlli's Avatar
 
Join Date: May 2009
Location: Slovenia
Posts: 7,161
Reputation: 361
Default Dynamic circles (TextDraw, Object, 3D Label, Pickup, Map icon)

General:

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

Pictures and Videos:

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

Object circles:


3D Label circles:


Pickup circles:


Map icon circles:




Credits and Required files:

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



Functions and Callbacks:

TextDraw circles:
Code:
// 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:
Code:
// 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:
Code:
// 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:
Code:
// 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:
Code:
// 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:


Last edited by Correlli; 05/05/2017 at 07:37 PM.
Correlli is offline   Reply With Quote
 

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
How to add pickup icon? BlazeGaming Scripting Help 3 28/12/2014 12:07 PM
Dynamic Pickup/Label Help Joshy_Elite Scripting Help 2 29/03/2013 12:05 AM
dynamic map icon Tanush123 Scripting Help 5 03/01/2012 09:50 PM
Pickup Icon help JD Help Archive 1 09/12/2010 10:51 PM


All times are GMT. The time now is 12:13 AM.


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