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

GetVectorDistance ~ TE_SetupBeamRingPoint


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hennesy
Member
Join Date: Nov 2018
Location: Czech Republic
Old 09-16-2021 , 03:58   GetVectorDistance ~ TE_SetupBeamRingPoint
Reply With Quote #1

PHP Code:
float fDist 700.0// in the code it is a dynamic variable.

TE_SetupBeamRingPoint(fPosfDistfDist+0.1g_BeamSprite0011.02.30.0, {25500255}, 10);
TE_SendToAll();

GetClientAbsOrigin(iclientPos);
if(
GetVectorDistance(fPosclientPos) >= RoundToFloor(fDist/100*50))
{
    
// ~ Runs much further than TE_SetupBeamRingPoint

I want to get it, if the player went outside the circle, then do something with him. But so far it does not come out very smoothly
__________________
I'm sorry for my english
Hennesy is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 09-16-2021 , 11:17   Re: GetVectorDistance ~ TE_SetupBeamRingPoint
Reply With Quote #2

Maybe would work if you store the beam pos in some plugin variable and then check if the player is outside through a repeat timer.

some small snippet about what I mean (didn't test is just some hints),
maybe someone else came with another solution.

also don't forget to reset the beamPos on round_end / map_change etc
I'm considering that there is only one beam per match and probably something can be done better.

PHP Code:
float beamPos[3];

public 
void OnPluginStart()
{
    
CreateTimer(1.0TimerCheckBeam_TIMER_REPEAT);
}

void FunctionThatCreatesTheBeam()
{
//...
    
beamPos fPos;
    
TE_SetupBeamRingPoint(fPosfDistfDist+0.1g_BeamSprite0011.02.30.0, {25500255}, 10);
    
TE_SendToAll();
//...
}

public 
Action TimerCheckBeam(Handle timer)
{
    
float clientPos[3];

    for (
int client 1client <= MaxClientsclient++)
    {
        if (!
IsClientInGame(client))
            continue;

        
GetClientAbsOrigin(clientclientPos);

        if(
GetVectorDistance(beamPosclientPos) >= RoundToFloor(fDist/100*50))
        {
            
//do something
        
}
    }

    return 
Plugin_Continue;

__________________

Last edited by Marttt; 09-16-2021 at 11:18.
Marttt is offline
Hennesy
Member
Join Date: Nov 2018
Location: Czech Republic
Old 09-16-2021 , 11:34   Re: GetVectorDistance ~ TE_SetupBeamRingPoint
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
Maybe would work if you store the beam pos in some plugin variable and then check if the player is outside through a repeat timer.

some small snippet about what I mean (didn't test is just some hints),
maybe someone else came with another solution.

also don't forget to reset the beamPos on round_end / map_change etc
I'm considering that there is only one beam per match and probably something can be done better.
Apparently you did not understand what I mean, I asked specifically for GetVectorDistance the specified value that you have what I have will not lead to the best result. because the code in this case works if you go far away from the beam
__________________
I'm sorry for my english
Hennesy is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 09-16-2021 , 11:42   Re: GetVectorDistance ~ TE_SetupBeamRingPoint
Reply With Quote #4

TE_SetupBeamRingPoint creates a "temp entity", is not possible to retrieve the position later unless you store it somewhere.

Then you have to check from time to time to check if the client is inside or outside the beam.
You could use a trigger_multiple (SQUARE) aswell together with the beam (CIRCLE) to achieve something similar

I was thinking on something like PUBG that players outside the "cloud" get damage per second.

Anyway is best to wait for someone that can understand what you mean better.
__________________
Marttt 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 13:39.


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