Raised This Month: $32 Target: $400
 8% 

Make a circle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stephen473
Senior Member
Join Date: Jan 2017
Location: somewhere on earth
Old 04-13-2017 , 17:44   Make a circle
Reply With Quote #1

Hi guys i tried to make a plugin which teleport terrorist on a circle

here is my code:
HTML Code:
void Circle(int target, int radius)
{

	int d = radius;
	float newpos[3];
	float targetpos[3];
	
	GetClientAbsOrigin(target, targetpos);
	
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && IsPlayerAlive(i) && target != i && GetClientTeam(i) == 2)
		{
			
			float x = (Cosine(PI * 2 * i / n) * d);
			float y = (Sine(PI * 2 * i / n) * d);
			newpos[0] = targetpos[0] + x;
			newpos[1] = targetpos[1] + y;
			newpos[2] = targetpos[2];
			
			float vec[3];
			SubtractVectors(targetpos, newpos, vec);
			NormalizeVector(vec, vec);
			float angles[3];
			GetVectorAngles(vec, angles);  
			
			TeleportEntity(i, newpos, angles, NULL_VECTOR);
		}
	}
}
but not working,can someone fix this?
stephen473 is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 04-13-2017 , 17:58   Re: Make a circle
Reply With Quote #2

https://forums.alliedmods.net/showth...ghlight=circle
https://forums.alliedmods.net/showth...ghlight=circle
https://github.com/shanapu/MyCircle

https://github.com/shanapu/MyCircle/...e.sp#L370-L396
PHP Code:
    float clientPos[3], ang[3], unitradius;
    
GetClientAbsOrigin(clientclientPos);
    
GetClientEyeAngles(clientang);
    
unitradius radius 52.49343832020997;

    for (
int i 0GetArraySize(g_aCircle); i++)
    {
        
float newPos[3], vec[3], angles[3];
        
newPos[0] = clientPos[0] + (Cosine(DegToRad(angle) * GetArraySize(g_aCircle)) * unitradius);
        
newPos[1] = clientPos[1] + (Sine(DegToRad(angle) * GetArraySize(g_aCircle)) * unitradius);

        if (
gc_bHoverCircle.BoolValue)
        {
            
newPos[2] = clientPos[2] + 10;
        }
        else
        {
            
newPos[2] = clientPos[2];
        }

        
SubtractVectors(clientPosnewPosvec);
        
NormalizeVector(vecvec);
        
GetVectorAngles(vecangles);

        
int iClient GetArrayCell(g_aCirclei);
        
SetEntityRenderColor(iClientg_iColorPlayer[0], g_iColorPlayer[1], g_iColorPlayer[2], 255);
        
TeleportEntity(iClientnewPosanglesNULL_VECTOR);

__________________
coding & free software
shanapu is offline
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 00:17.


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