Raised This Month: $51 Target: $400
 12% 

How to create circle


Post New Thread Reply   
 
Thread Tools Display Modes
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-24-2019 , 14:59   Re: How to create circle
Reply With Quote #11

you are correct E1 i want work with cylinder and not sphere, let me explain how this should work in a point of view you can see a circle lets assume the circle is faced up if you look at the circle from up (X & Y) Axis you see a circle thats mean you should use this equation R = SQROOT ( ( P_X - C_X) ^2 + ( P_Y - C_Y)^2 ) and from aside view (X & Z or Y & Z axises) you will see a shape like a rectangle in this situation i'm not certain what equation should i use to detect if the player is between the rectangle shape
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Old 09-25-2019, 08:30
Smilex_Gamer
This message has been deleted by Smilex_Gamer.
Old 09-25-2019, 18:04
Natsheh
This message has been deleted by Natsheh.
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-28-2019 , 12:31   Re: How to create circle
Reply With Quote #12

alright new update i have a vector, what i want is to draw a circle around the vector..

............................................. ....................
...........................................
..........................
.............
.....
...
..
.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-29-2019 at 12:36.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-29-2019 , 14:51   Re: How to create circle
Reply With Quote #13

i have been able to create a circle only in around the Z axis

here's the code

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <xs>

#define PLUGIN "Health circle"
#define VERSION "1.0"
#define AUTHOR "Natsheh"

new g_sprite;

#define X 0
#define Y 1
#define Z 2

public plugin_precache() g_sprite precache_model("sprites/laserbeam.spr");

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("amx_health_circle""handler_command"ADMIN_KICK"<rad> <width> <rotate axis x> <rotate axis y>");
    
register_clcmd("amx_delete_health_circle""handler_command2"ADMIN_KICK"remove health circle nearby!");
    
register_think("health_circle""brain_work");
}

public 
handler_command2(idlevelcid)
{
    if(!
cmd_access(idlevelcid1)) return 1;
    
    new 
ent = -1target_circle 0Float:wanted_distance 250.0Float:fOrigin[3], Float:fOrigin2[3], Float:z;
    
pev(idpev_originfOrigin);
    while( (
ent find_ent_by_class(ent"health_circle")) > )
    {
        
pev(entpev_originfOrigin2);
        if( (
z=get_distance_f(fOriginfOrigin2)) <= wanted_distance )
        {
            
target_circle entwanted_distance z;
        }
    }
    
    if(
target_circle 0)
    {
        
set_entity_flags(target_circleFL_KILLMEtrue);
        
console_print(id"The health circle nearby was removed!");
    }
    else
    {
        
console_print(id"No health circles were found!");
    }
    return 
1;
}

public 
handler_command(idlevelcid)
{
    if(!
cmd_access(idlevelcid2)) return 1;
    
    new 
szRadius[5], szWidth[5], szAngle_X[5], szAngle_Y[5];
    
read_argv(1szRadiuscharsmax(szRadius));
    
read_argv(2szWidthcharsmax(szWidth));
    
read_argv(3szAngle_Xcharsmax(szAngle_X));
    
read_argv(4szAngle_Ycharsmax(szAngle_Y));
    
    
remove_quotes(szRadius);
    
remove_quotes(szWidth);
    
remove_quotes(szAngle_X);
    
remove_quotes(szAngle_Y);
    
    new 
ent create_entity("info_target");
    
    if(
ent 0)
    {
        
entity_set_string(entEV_SZ_classname"health_circle");
        
        new 
Float:fAngles[3];
        
        
entity_get_vector(idEV_VEC_originfAngles);
        
entity_set_origin(entfAngles);
        
        
entity_set_int(entEV_INT_iuser4str_to_num(szWidth));
        
entity_set_float(entEV_FL_fuser4floatstr(szRadius));
        
        
fAngles[0] = floatstr(szAngle_X);
        
fAngles[1] = floatstr(szAngle_Y);
        
entity_set_vector(entEV_VEC_anglesfAngles);
        
entity_set_int(entEV_INT_fixangletrue);
        
        
entity_set_int(entEV_INT_solidSOLID_TRIGGER);
        
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1);
        
console_print(id"Health circle has been created!");
    }
    else
    {
        
console_print(id"Failed to create the health circle!");
    }
    
    return 
1;
}

public 
brain_work(id)
{
    static 
Float:fAngles[3], Float:fRadius[3], Float:fOrigin[3], Float:fWidthFloat:fPos[3], i;
    
pev(idpev_anglesfAngles);
    
pev(idpev_originfOrigin)
    
fWidth float(pev(idpev_iuser4));
    
pev(idpev_fuser4fRadius[X]);
    
fRadius[Y] = fRadius[Z] = 0.0;
    
    
fPos[X] = floatcos(fAngles[X],degrees) * floatcos(fAngles[Y],degrees) * fRadius[X] - floatsin(fAngles[Y],degrees) * fRadius[Y] + floatcos(fAngles[Y],degrees) * floatsin(fAngles[X],degrees) * fRadius[Z];
    
fPos[Y] = floatsin(fAngles[Y],degrees) * floatcos(fAngles[X],degrees) * fRadius[X] + floatcos(fAngles[Y],degrees) * fRadius[Y] + floatsin(fAngles[Y],degrees) * floatsin(fAngles[X],degrees) * fRadius[Z];
    
fPos[Z] = -floatsin(fAngles[X],degrees) * fRadius[X] + floatcos(fAngles[Y],degrees) * fRadius[Z];
    
xs_vec_add(fPosfOriginfPos);
    
createline(fOriginfPos25500)
    
    const 
Float:fDivides 30.0;
    static 
Float:fTemp[3], Float:fAngle[3], Float:fVector[3] = { 0.00.00.0 }, Float:fStart[3];
    
    
xs_vec_copy(fAnglesfAngle);
    
fAngle[Y] += 90.0;
    for(
0<= floatround(360.0/fDivides); i++)
    {
        if(
0)
        {
            
xs_vec_copy(fVectorfStart);
            
        }
        
        
fAngle[X] += fDivides;
        
fTemp[X] = floatcos(fAngle[X],degrees) * floatcos(fAngle[Y],degrees) * fRadius[X] - floatsin(fAngle[Y],degrees) * fRadius[Y] + floatcos(fAngle[Y],degrees) * floatsin(fAngle[X],degrees) * fRadius[Z];
        
fTemp[Y] = floatsin(fAngle[Y],degrees) * floatcos(fAngle[X],degrees) * fRadius[X] + floatcos(fAngle[Y],degrees) * fRadius[Y] + floatsin(fAngle[Y],degrees) * floatsin(fAngle[X],degrees) * fRadius[Z];
        
fTemp[Z] = -floatsin(fAngle[X],degrees) * fRadius[X] + floatcos(fAngle[Y],degrees) * fRadius[Z];
        
        
xs_vec_add(fOriginfTempfVector);
        
        if(
0)
        {
            
createline(fStartfVector)
        }
    }
    
    
entity_set_float(idEV_FL_nextthinkget_gametime() + 1.0);
}

createline(Float:fStart[3], Float:fOrigin[3], r=0g=255b=0)
{
    
message_begin(MSG_ALLSVC_TEMPENTITY)
    
write_byte(0)
    
write_coord(floatround(fStart[0]))
    
write_coord(floatround(fStart[1]))
    
write_coord(floatround(fStart[2]))
    
write_coord(floatround(fOrigin[0]))
    
write_coord(floatround(fOrigin[1]))
    
write_coord(floatround(fOrigin[2]))
    
write_short(g_sprite)
    
write_byte(0
    
write_byte(0
    
write_byte(10
    
write_byte(15
    
write_byte(0
    
write_byte(r)
    
write_byte(g)
    
write_byte(b)
    
write_byte(255)
    
write_byte(0)
    
message_end()

now i need to be able to rotate the circle also around Y/X direction
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Smilex_Gamer
Senior Member
Join Date: Apr 2017
Location: Portugal
Old 09-29-2019 , 19:39   Re: How to create circle
Reply With Quote #14

Quote:
Originally Posted by Natsheh View Post
i have been able to create a circle only in around the Z axis

here's the code

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <xs>

#define PLUGIN "Health circle"
#define VERSION "1.0"
#define AUTHOR "Natsheh"

new g_sprite;

#define X 0
#define Y 1
#define Z 2

public plugin_precache() g_sprite precache_model("sprites/laserbeam.spr");

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("amx_health_circle""handler_command"ADMIN_KICK"<rad> <width> <rotate axis x> <rotate axis y>");
    
register_clcmd("amx_delete_health_circle""handler_command2"ADMIN_KICK"remove health circle nearby!");
    
register_think("health_circle""brain_work");
}

public 
handler_command2(idlevelcid)
{
    if(!
cmd_access(idlevelcid1)) return 1;
    
    new 
ent = -1target_circle 0Float:wanted_distance 250.0Float:fOrigin[3], Float:fOrigin2[3], Float:z;
    
pev(idpev_originfOrigin);
    while( (
ent find_ent_by_class(ent"health_circle")) > )
    {
        
pev(entpev_originfOrigin2);
        if( (
z=get_distance_f(fOriginfOrigin2)) <= wanted_distance )
        {
            
target_circle entwanted_distance z;
        }
    }
    
    if(
target_circle 0)
    {
        
set_entity_flags(target_circleFL_KILLMEtrue);
        
console_print(id"The health circle nearby was removed!");
    }
    else
    {
        
console_print(id"No health circles were found!");
    }
    return 
1;
}

public 
handler_command(idlevelcid)
{
    if(!
cmd_access(idlevelcid2)) return 1;
    
    new 
szRadius[5], szWidth[5], szAngle_X[5], szAngle_Y[5];
    
read_argv(1szRadiuscharsmax(szRadius));
    
read_argv(2szWidthcharsmax(szWidth));
    
read_argv(3szAngle_Xcharsmax(szAngle_X));
    
read_argv(4szAngle_Ycharsmax(szAngle_Y));
    
    
remove_quotes(szRadius);
    
remove_quotes(szWidth);
    
remove_quotes(szAngle_X);
    
remove_quotes(szAngle_Y);
    
    new 
ent create_entity("info_target");
    
    if(
ent 0)
    {
        
entity_set_string(entEV_SZ_classname"health_circle");
        
        new 
Float:fAngles[3];
        
        
entity_get_vector(idEV_VEC_originfAngles);
        
entity_set_origin(entfAngles);
        
        
entity_set_int(entEV_INT_iuser4str_to_num(szWidth));
        
entity_set_float(entEV_FL_fuser4floatstr(szRadius));
        
        
fAngles[0] = floatstr(szAngle_X);
        
fAngles[1] = floatstr(szAngle_Y);
        
entity_set_vector(entEV_VEC_anglesfAngles);
        
entity_set_int(entEV_INT_fixangletrue);
        
        
entity_set_int(entEV_INT_solidSOLID_TRIGGER);
        
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1);
        
console_print(id"Health circle has been created!");
    }
    else
    {
        
console_print(id"Failed to create the health circle!");
    }
    
    return 
1;
}

public 
brain_work(id)
{
    static 
Float:fAngles[3], Float:fRadius[3], Float:fOrigin[3], Float:fWidthFloat:fPos[3], i;
    
pev(idpev_anglesfAngles);
    
pev(idpev_originfOrigin)
    
fWidth float(pev(idpev_iuser4));
    
pev(idpev_fuser4fRadius[X]);
    
fRadius[Y] = fRadius[Z] = 0.0;
    
    
fPos[X] = floatcos(fAngles[X],degrees) * floatcos(fAngles[Y],degrees) * fRadius[X] - floatsin(fAngles[Y],degrees) * fRadius[Y] + floatcos(fAngles[Y],degrees) * floatsin(fAngles[X],degrees) * fRadius[Z];
    
fPos[Y] = floatsin(fAngles[Y],degrees) * floatcos(fAngles[X],degrees) * fRadius[X] + floatcos(fAngles[Y],degrees) * fRadius[Y] + floatsin(fAngles[Y],degrees) * floatsin(fAngles[X],degrees) * fRadius[Z];
    
fPos[Z] = -floatsin(fAngles[X],degrees) * fRadius[X] + floatcos(fAngles[Y],degrees) * fRadius[Z];
    
xs_vec_add(fPosfOriginfPos);
    
createline(fOriginfPos25500)
    
    const 
Float:fDivides 30.0;
    static 
Float:fTemp[3], Float:fAngle[3], Float:fVector[3] = { 0.00.00.0 }, Float:fStart[3];
    
    
xs_vec_copy(fAnglesfAngle);
    
fAngle[Y] += 90.0;
    for(
0<= floatround(360.0/fDivides); i++)
    {
        if(
0)
        {
            
xs_vec_copy(fVectorfStart);
            
        }
        
        
fAngle[X] += fDivides;
        
fTemp[X] = floatcos(fAngle[X],degrees) * floatcos(fAngle[Y],degrees) * fRadius[X] - floatsin(fAngle[Y],degrees) * fRadius[Y] + floatcos(fAngle[Y],degrees) * floatsin(fAngle[X],degrees) * fRadius[Z];
        
fTemp[Y] = floatsin(fAngle[Y],degrees) * floatcos(fAngle[X],degrees) * fRadius[X] + floatcos(fAngle[Y],degrees) * fRadius[Y] + floatsin(fAngle[Y],degrees) * floatsin(fAngle[X],degrees) * fRadius[Z];
        
fTemp[Z] = -floatsin(fAngle[X],degrees) * fRadius[X] + floatcos(fAngle[Y],degrees) * fRadius[Z];
        
        
xs_vec_add(fOriginfTempfVector);
        
        if(
0)
        {
            
createline(fStartfVector)
        }
    }
    
    
entity_set_float(idEV_FL_nextthinkget_gametime() + 1.0);
}

createline(Float:fStart[3], Float:fOrigin[3], r=0g=255b=0)
{
    
message_begin(MSG_ALLSVC_TEMPENTITY)
    
write_byte(0)
    
write_coord(floatround(fStart[0]))
    
write_coord(floatround(fStart[1]))
    
write_coord(floatround(fStart[2]))
    
write_coord(floatround(fOrigin[0]))
    
write_coord(floatround(fOrigin[1]))
    
write_coord(floatround(fOrigin[2]))
    
write_short(g_sprite)
    
write_byte(0
    
write_byte(0
    
write_byte(10
    
write_byte(15
    
write_byte(0
    
write_byte(r)
    
write_byte(g)
    
write_byte(b)
    
write_byte(255)
    
write_byte(0)
    
message_end()

now i need to be able to rotate the circle also around Y/X direction
wow now that's more confusing than before xd this is really difficult tho.
This can still be applied (I guess so):

On plugin_init:
PHP Code:
register_clcmd("inside_circle""inside_circle"ADMIN_KICK); 
Checking if the player is inside the circle:
PHP Code:
public inside_circle(idlevelcid)
{
    if(!
cmd_access(idlevelcid1)) return 1;

    new 
ent = -1target_circle 0Float:Circle_Origin[3], Float:Player_Origin[3], Float:wanted_distance 250.0Float:z;
    
pev(idpev_originPlayer_Origin);

    while( (
ent find_ent_by_class(ent"health_circle")) > )
    {
        
pev(entpev_originCircle_Origin);
        if( (
z=get_distance_f(Player_OriginCircle_Origin)) <= wanted_distance )
        {
            
target_circle entwanted_distance z;
        }
    }

    if(
target_circle 0)
    {
        new 
Float:Radius[3];
        
pev(target_circlepev_fuser4Radius[X]);
        if( (
floatsqroot(get_distance_f(Player_OriginCircle_Origin))) < floatsqroot(Radius[X]) )
        {
            
console_print(id"Player is inside circle");
        }
        else
        {
            
console_print(id"Player is not inside circle");
        }
    }
    else
    {
            
console_print(id"No health circles were found");
    }
    return 
1;

Although this code searchs if the player is inside the circle, sadly it will search in a sphere. So, that is a beginning. The rest I think you can manage to do it (I hope so).

Edit: I think I know how to check it only in a circle but that would require to the circles have a rotation of 0° (or 180°) or 90° (or 270°).
After "if( (floatsqroot(get_distance_f(Player_Origin, Circle_Origin))) < floatsqroot(Radius[X]) )" we can add something like this:

PHP Code:
if( Player_Origin[Y] == Circle_Origin[Y] ) // only if the circle has a Y rotation of 0° or 180° 
or...

PHP Code:
if( Player_Origin[X] == Circle_Origin[X] ) // only if the circle has a Y rotation of 90° or 270° 
For the current rotations, in theory that should work.

Last edited by Smilex_Gamer; 09-30-2019 at 02:14.
Smilex_Gamer is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-30-2019 , 04:39   Re: How to create circle
Reply With Quote #15

Nvm I quit....
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Smilex_Gamer
Senior Member
Join Date: Apr 2017
Location: Portugal
Old 09-30-2019 , 09:18   Re: How to create circle
Reply With Quote #16

Quote:
Originally Posted by Natsheh View Post
Nvm I quit....
Really? I was thinking another way of checking if the player is inside the circle and this way you don't need to specify the rotation (because it works with any rotation), you only need to get the X, Y and Z maximum and minimum coordinates of the circle you're making. Later I'll post here the code, if you're still interested in doing this.

Last edited by Smilex_Gamer; 09-30-2019 at 09:20.
Smilex_Gamer is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-30-2019 , 09:48   Re: How to create circle
Reply With Quote #17

i'm not trying to find a player inside a circle im trying to draw a circle depending on different point of view...

let me explain this more...

i have a vector in a specified direction i want to rotate another vector around it in order to draw a circle...

for some reason i managed to draw a circle in XZ & YZ plane but failed to draw it in the X Y plane... not been able to rotate around the X axis
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Smilex_Gamer
Senior Member
Join Date: Apr 2017
Location: Portugal
Old 09-30-2019 , 10:01   Re: How to create circle
Reply With Quote #18

Quote:
Originally Posted by Natsheh View Post
i'm not trying to find a player inside a circle im trying to draw a circle depending on different point of view...

let me explain this more...

i have a vector in a specified direction i want to rotate another vector around it in order to draw a circle...

for some reason i managed to draw a circle in XZ & YZ plane but failed to draw it in the X Y plane... not been able to rotate around the X axis
I will try to do it. Then I tell you if I could make it.
P.S: And what about checking if the player is inside the circle? In the first post you mentioned that.
Smilex_Gamer is offline
Smilex_Gamer
Senior Member
Join Date: Apr 2017
Location: Portugal
Old 09-30-2019 , 12:01   Re: How to create circle
Reply With Quote #19

Okay, checking if the player is inside the circle is done (at least, it's more accurate now).
Later I'll try make the circle be in the XY plane.

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <xs>

#define PLUGIN "Health circle"
#define VERSION "1.0"
#define AUTHOR "Natsheh"

new g_sprite;

#define X 0
#define Y 1
#define Z 2
#define GAP 2 // this is for checking if the player is inside the circle. Because the maxs and mins are the sprites themselves, this gap is for decreasing the area where the player is inside the circle (eg. if the circle is in the XZ plane, this will decrease 
#define SPR_LENGHT 2 // sprite lenght. current sprite "laserbeam" is around 2. this lenght is for increasing the area where the player is inside the circle (eg. if the circle is in the XZ plane, this will increase the Y maxs and mins)

new Float:Maxs_Origin[4096][3], Float:Mins_Origin[4096][3];

public 
plugin_precache() g_sprite precache_model("sprites/laserbeam.spr");

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("amx_health_circle""handler_command"ADMIN_KICK"<rad> <width> <rotate axis x> <rotate axis y>");
    
register_clcmd("amx_delete_health_circle""handler_command2"ADMIN_KICK"remove health circle nearby!");
    
register_think("health_circle""brain_work");
    
register_clcmd("inside_circle""inside_circle");
}

public 
handler_command2(idlevelcid)
{
    if(!
cmd_access(idlevelcid1)) return 1;
    
    new 
ent = -1target_circle 0Float:wanted_distance 250.0Float:fOrigin[3], Float:fOrigin2[3], Float:z;
    
pev(idpev_originfOrigin);
    while( (
ent find_ent_by_class(ent"health_circle")) > )
    {
        
pev(entpev_originfOrigin2);
        if( (
z=get_distance_f(fOriginfOrigin2)) <= wanted_distance )
        {
            
target_circle entwanted_distance z;
        }
    }
    
    if(
target_circle 0)
    {
        
set_entity_flags(target_circleFL_KILLMEtrue);
        
console_print(id"The health circle nearby was removed!");
    }
    else
    {
        
console_print(id"No health circles were found!");
    }
    return 
1;
}

public 
handler_command(idlevelcid)
{
    if(!
cmd_access(idlevelcid2)) return 1;
    
    new 
szRadius[5], szWidth[5], szAngle_X[5], szAngle_Y[5];
    
read_argv(1szRadiuscharsmax(szRadius));
    
read_argv(2szWidthcharsmax(szWidth));
    
read_argv(3szAngle_Xcharsmax(szAngle_X));
    
read_argv(4szAngle_Ycharsmax(szAngle_Y));
    
    
remove_quotes(szRadius);
    
remove_quotes(szWidth);
    
remove_quotes(szAngle_X);
    
remove_quotes(szAngle_Y);
    
    new 
ent create_entity("info_target");
    
    if(
ent 0)
    {
        
entity_set_string(entEV_SZ_classname"health_circle");
        
        new 
Float:fAngles[3];
        
        
entity_get_vector(idEV_VEC_originfAngles);
        
entity_set_origin(entfAngles);
        
        
entity_set_int(entEV_INT_iuser4str_to_num(szWidth));
        
entity_set_float(entEV_FL_fuser4floatstr(szRadius));
        
        
fAngles[0] = floatstr(szAngle_X);
        
fAngles[1] = floatstr(szAngle_Y);
        
entity_set_vector(entEV_VEC_anglesfAngles);
        
entity_set_int(entEV_INT_fixangletrue);
        
        
entity_set_int(entEV_INT_solidSOLID_TRIGGER);
        
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1);
        
console_print(id"Health circle has been created!");
    }
    else
    {
        
console_print(id"Failed to create the health circle!");
    }
    
    return 
1;
}

public 
brain_work(id)
{
    static 
Float:fAngles[3], Float:fRadius[3], Float:fOrigin[3], Float:fWidthFloat:fPos[3], i;
    
pev(idpev_anglesfAngles);
    
pev(idpev_originfOrigin)
    
Maxs_Origin[id] = fOrigin;
    
Mins_Origin[id] = fOrigin;
    
fWidth float(pev(idpev_iuser4));
    
pev(idpev_fuser4fRadius[X]);
    
fRadius[Y] = fRadius[Z] = 0.0;
    
    
fPos[X] = floatcos(fAngles[X],degrees) * floatcos(fAngles[Y],degrees) * fRadius[X] - floatsin(fAngles[Y],degrees) * fRadius[Y] + floatcos(fAngles[Y],degrees) * floatsin(fAngles[X],degrees) * fRadius[Z];
    
fPos[Y] = floatsin(fAngles[Y],degrees) * floatcos(fAngles[X],degrees) * fRadius[X] + floatcos(fAngles[Y],degrees) * fRadius[Y] + floatsin(fAngles[Y],degrees) * floatsin(fAngles[X],degrees) * fRadius[Z];
    
fPos[Z] = -floatsin(fAngles[X],degrees) * fRadius[X] + floatcos(fAngles[Y],degrees) * fRadius[Z];
    
xs_vec_add(fPosfOriginfPos);
    
createline(fOriginfPos25500)
    
    const 
Float:fDivides 30.0;
    static 
Float:fTemp[3], Float:fAngle[3], Float:fVector[3] = { 0.00.00.0 }, Float:fStart[3];
    
    
xs_vec_copy(fAnglesfAngle);
    
fAngle[Y] += 90.0;
    for(
0<= floatround(360.0/fDivides); i++)
    {
        if(
0)
        {
            
xs_vec_copy(fVectorfStart); 
        }
        
        
fAngle[X] += fDivides;
        
fTemp[X] = floatcos(fAngle[X],degrees) * floatcos(fAngle[Y],degrees) * fRadius[X] - floatsin(fAngle[Y],degrees) * fRadius[Y] + floatcos(fAngle[Y],degrees) * floatsin(fAngle[X],degrees) * fRadius[Z];
        
fTemp[Y] = floatsin(fAngle[Y],degrees) * floatcos(fAngle[X],degrees) * fRadius[X] + floatcos(fAngle[Y],degrees) * fRadius[Y] + floatsin(fAngle[Y],degrees) * floatsin(fAngle[X],degrees) * fRadius[Z];
        
fTemp[Z] = -floatsin(fAngle[X],degrees) * fRadius[X] + floatcos(fAngle[Y],degrees) * fRadius[Z];
        
        
xs_vec_add(fOriginfTempfVector);
        
        if(
fVector[X] < Mins_Origin[id][X])
        {
            
Mins_Origin[id][X] = fVector[X] + GAP
        
}
        else if(
fVector[X] > Maxs_Origin[id][X])
        {
            
Maxs_Origin[id][X] = fVector[X] - GAP
        
}
        else if(
fVector[Y] < Mins_Origin[id][Y])
        {
            
Mins_Origin[id][Y] = fVector[Y] + GAP
        
}
        else if(
fVector[Y] > Maxs_Origin[id][Y])
        {
            
Maxs_Origin[id][Y] = fVector[Y] - GAP
        
}
        else if(
fVector[Z] < Mins_Origin[id][Z])
        {
            
Mins_Origin[id][Z] = fVector[Z] + GAP
        
}
        else if(
fVector[Z] > Maxs_Origin[id][Z])
        {
            
Maxs_Origin[id][Z] = fVector[Z] - GAP
        
}

        if(
Maxs_Origin[id][X] == Mins_Origin[id][X])
        {
            
Mins_Origin[id][X] -= SPR_LENGHT
            Maxs_Origin
[id][X] += SPR_LENGHT
        
}
        else if(
Maxs_Origin[id][Y] == Mins_Origin[id][Y])
        {
            
Mins_Origin[id][Y] -= SPR_LENGHT
            Maxs_Origin
[id][Y] += SPR_LENGHT
        
}
        else if(
Maxs_Origin[id][Z] == Mins_Origin[id][Z])
        {
            
Mins_Origin[id][Z] -= SPR_LENGHT
            Maxs_Origin
[id][Z] += SPR_LENGHT
        
}

        if(
0)
        {
            
createline(fStartfVector)
        }
    }
    
    
entity_set_float(idEV_FL_nextthinkget_gametime() + 1.0);
}

public 
inside_circle(id)
{
    new 
ent = -1target_circle 0Float:Circle_Origin[3], Float:Player_Origin[3], Float:wanted_distance 250.0Float:z;
    
pev(idpev_originPlayer_Origin);

    while( (
ent find_ent_by_class(ent"health_circle")) > )
    {
        
pev(entpev_originCircle_Origin);
        if( (
z=get_distance_f(Player_OriginCircle_Origin)) <= wanted_distance )
        {
            
target_circle entwanted_distance z;
        }
    }

    if(
target_circle 0)
    {
        if( (
Mins_Origin[target_circle][X] < Player_Origin[X]) && (Player_Origin[X] < Maxs_Origin[target_circle][X]) && (Mins_Origin[target_circle][Y] < Player_Origin[Y]) && (Player_Origin[Y] < Maxs_Origin[target_circle][Y]) && (Mins_Origin[target_circle][Z] < Player_Origin[Z]) && (Player_Origin[Z] < Maxs_Origin[target_circle][Z]) )
        {
            
console_print(id"Player is inside circle");
        }
        else
        {
            
console_print(id"Player is not inside circle");
        }
    }
    else
    {
            
console_print(id"No health circles were found");
    }
    return 
1;
}

createline(Float:fStart[3], Float:fOrigin[3], r=0g=255b=0)
{
    
message_begin(MSG_ALLSVC_TEMPENTITY)
    
write_byte(0)
    
write_coord(floatround(fStart[0]))
    
write_coord(floatround(fStart[1]))
    
write_coord(floatround(fStart[2]))
    
write_coord(floatround(fOrigin[0]))
    
write_coord(floatround(fOrigin[1]))
    
write_coord(floatround(fOrigin[2]))
    
write_short(g_sprite)
    
write_byte(0
    
write_byte(0
    
write_byte(10
    
write_byte(15
    
write_byte(0
    
write_byte(r)
    
write_byte(g)
    
write_byte(b)
    
write_byte(255)
    
write_byte(0)
    
message_end()


Last edited by Smilex_Gamer; 09-30-2019 at 12:01.
Smilex_Gamer is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-30-2019 , 13:59   Re: How to create circle
Reply With Quote #20

i'm not worried about getting the player in the circle right now but more about drawing the circle.

actually i want to be able to rotate the circle with given inputs...

so i want to be able to create a circle around a vector

i almost done it but remains one thing rotating the vector around the main vector to create a circle point by point.

my goal is to create a circle in vector plane and not just in XY and ZY nor ZX axis's plane...


my latest update.
Spoiler
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-01-2019 at 03:05.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



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

Forum Jump


All times are GMT -4. The time now is 03:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode