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

Solved TeleportEntity function?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
desire worker
Junior Member
Join Date: Dec 2018
Location: Umbrella Corporation
Old 12-14-2018 , 09:55   TeleportEntity function?
Reply With Quote #1

I saw the Wiki first but didn`t understand well. my code is working crazy now due to this function.

--------------------------------------------------------------
Syntax:
native TeleportEntity(entity, const Floatrigin[3], const Float:angles[3], const Float:velocity[3]);

Usage:
entity Client index.
origin New origin, or NULL_VECTOR for no change.
angles New angles, or NULL_VECTOR for no change.
velocity New velocity, or NULL_VECTOR for no change.
--------------------------------------------------------------

Grasping meaning of entity, origin is fine but the others make me confused

suppose that there are 3rd dimensional vector space.

and wanna move 'client' in vector CP(x1, y1, z1) to vector DP(x2, y2, z2)



then the code be the below because we wanna teleport 'client' to
designated position DP(x2, y2, z2)


Code:
TeleportEntity(client, DP);
but what is angle vector and velocity vector?

I was think below two things for each but neither was wrong.

angle vector : view direction of client after teleport? or direction vector during teleport?
velocity vector : velocity during teleport? velocity of client after teleport?
Attached Thumbnails
Click image for larger version

Name:	s.png
Views:	399
Size:	10.4 KB
ID:	172751  

Last edited by desire worker; 12-14-2018 at 20:24. Reason: misspelling
desire worker is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 12-14-2018 , 11:59   Re: TeleportEntity function?
Reply With Quote #2

They set the direction and velocity. It could be broken up to three separate functions (SetPosition, SetAngles/Direction, SetVelocity), but the function in the game itself is just one so it was left the same.
Fyren is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 12-14-2018 , 12:35   Re: TeleportEntity function?
Reply With Quote #3

DP[0] = Position on the X axis ( left and right )
DP[1] = Position on the Y axis ( front and back )*
DP[2] = Position on the Z axis ( up and down ).

Without regard, there are angles, where in space should the player look. I find it hard to grasp why isn't there just up and down, left and right ( 2 total dimensions ) but I'm not that of an expert on vectors.

And Velocity means speed + direction, that looks like Origin.

So if you give a player Velocity[2] = 1000.0;, he'll fly up. -1000.0 and he'll launch down.

* I might confuse X and Y, one of them is the other and I don't remember, and they can change by player perspective.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 12-14-2018 , 13:36   Re: TeleportEntity function?
Reply With Quote #4

If you want to just teleport from one coord to another one without changing angles (Camera position), according to your code you should do like this:
PHP Code:
TeleportEntity(clientDPNULL_VECTORNULL_VECTOR); 
Example of usage angles.
If you want teleport one player to any other player, you probably want to set his crosshair in the same place to crosshair of that second player.
Then you can do:
PHP Code:

void TeleportToPlayer
(int targetint otherPlayer)
{
    
float otherPlayerOrigin[3];
    
float otherPlayerAngles[3];
    
    
GetClientAbsOrigin(otherPlayerotherPlayerOrigin);
    
GetClientEyeAngles(otherPlayerotherPlayerAngles);
    
    
TeleportEntity(targetotherPlayerOriginotherPlayerAnglesNULL_VECTOR);

By the way, angles have only 2 dimensions. X and Y. ang[2] (z) always equals zero.

Last edited by impossible_cc; 12-14-2018 at 13:47.
impossible_cc is offline
desire worker
Junior Member
Join Date: Dec 2018
Location: Umbrella Corporation
Old 12-14-2018 , 20:24   Re: TeleportEntity function?
Reply With Quote #5

Ok, It was indicating properties after teleport, now I got it thanks you guys
desire worker is offline
Reply


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

Forum Jump


All times are GMT -4. The time now is 05:58.


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