Hello. I try to write some code which will teleport user using this;
PHP Code:
public plugin_init()
{
register_clcmd("say /tp", "tp" )
}
public tp( id )
{
new origin[3]
get_user_origin( id, origin )
origin[0] += 50 // will move forward because this is X-position based on CS
set_user_origin( id, origin )
}
It does teleport successfully but it didn't teleport forward( as I wanted it to do ) and It allow player to penetrate the wall too but then I saw Arkshine's post on how to move from A to B;
Quote:
Originally Posted by Arkshine
The purpose of a TraceLine is to trace a virtual line from point A to point B and seeing if it hits something.
To make a line, you need to know the Point A origin, and the Point B origin.
We know already player's origin, which is Point A (vOrigin).
To know the end origin, which is Point B, you need a direction and a length.
Length and direction you will want to apply from Point A.
Code:
A B
x---------->x
| length |
Since we don't care about length, you multiply the direction by a big number like 9999. (You could also use 8192 which is the max length of a map)
So you have "a long line" with a defined direction.To know the Point B origin, you just need to start the line from Point A.
That's why you add the Point A origin to this "long line". You need to tell from where you want to start to draw the line.
|
But, how do I redirect the player from point A to point B? Using vector? but the tutorial use
PHP Code:
new Float:fVelocity[3]
pev( id, pev_velocity, fVelocity )
Which I don't understand what it's trying to do...