Raised This Month: $ Target: $400
 0% 

[Help] Teleport and entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 01-05-2015 , 10:47   [Help] Teleport and entity
Reply With Quote #1

Hi guys, I'm trying to make a plugin which can teleport victim to the attacker's back
For example, player A shoot player B => player B will teleport to the back of player A
But I have a few trouble:

- I don't know how to teleport the victim to the back of the attacker (I tried the attacker's origin but it would be stuck)
- I want to create an entity with custom player models, when the victim has been teleported, the entity will appear at the old position of the victim and do the dead animation

Any ideas will be much appreciated
Thanks
__________________
Shiina.Mashiro is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 01-05-2015 , 11:42   Re: [Help] Teleport and entity
Reply With Quote #2

PHP Code:
get_target_behind(idFloat:fOrigin[3],units) {
    
    new 
Float:fAngles[3];
    new 
Float:fForward[3];
    
    
pev(id,pev_origin,fOrigin);
    
pev(id,pev_v_angle,fAngles);
    
    new 
Float:temp fOrigin[2];
    
    
angle_vector(fAngles,ANGLEVECTOR_FORWARD,fForward)
    
    
xs_vec_mul_scalar(fForward,(-1.0*units),fForward);
    
xs_vec_add(fForward,fOrigin,fOrigin);
    
    
fOrigin[2] = temp;

units is how far will be the origin from the enemy. 100-150 is ideal

Last edited by akcaliberg; 01-05-2015 at 11:43.
akcaliberg is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 01-05-2015 , 11:48   Re: [Help] Teleport and entity
Reply With Quote #3

1.you can use velocity by aim:
PHP Code:
new Float:Vel[3]
velocitybyaim(playerb_id20.0Vel[3]) 
then negate Vel[0] to Vel[2] and add them to player B's origin. The outcome will be player B's back. You can modify 20.0 to any number you want till you're satisfy.
2.You can take a look at some dias's npc plugins.
I'm typing from my phone so there's might be some typos

Last edited by RateX; 01-05-2015 at 11:50.
RateX is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 01-06-2015 , 01:31   Re: [Help] Teleport and entity
Reply With Quote #4

@akcaliberg
Tried your code but it teleport me to somewhere, just like i have noclip

@RateX
1. Negate Vel[0] to Vel[2] you mean Vel[0] = Vel[2] or Vel[2] = Vel[0] ?
2. Ya I checked at dias's oberon boss and it works fine but how to remove the entity at newround ?
__________________
Shiina.Mashiro is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 01-06-2015 , 02:39   Re: [Help] Teleport and entity
Reply With Quote #5

Quote:
Originally Posted by Shiina.Mashiro View Post
@akcaliberg
Tried your code but it teleport me to somewhere, just like i have noclip

@RateX
1. Negate Vel[0] to Vel[2] you mean Vel[0] = Vel[2] or Vel[2] = Vel[0] ?
2. Ya I checked at dias's oberon boss and it works fine but how to remove the entity at newround ?
maybe the enemies behind is wall or something. It works fine for me.
akcaliberg is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 01-06-2015 , 03:07   Re: [Help] Teleport and entity
Reply With Quote #6

Quote:
Originally Posted by akcaliberg View Post
maybe the enemies behind is wall or something. It works fine for me.

I'm not at home so I will send you the image later
So do you have anything to avoid this ?
__________________
Shiina.Mashiro is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 01-06-2015 , 08:11   Re: [Help] Teleport and entity
Reply With Quote #7

Quote:
Originally Posted by Shiina.Mashiro View Post
I'm not at home so I will send you the image later
So do you have anything to avoid this ?
Avoid what? If you mean the wall, you can simply check if there is a wall at that origin by creating an entity. If the entity touches anything that means there is another entity at the target origin and you can stuck if you teleport there. You can use that information however you want You can abort teleportation or you can teleport targets near. It is up to you.
akcaliberg is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-06-2015 , 09:37   Re: [Help] Teleport and entity
Reply With Quote #8

Quote:
Originally Posted by akcaliberg View Post
Avoid what? If you mean the wall, you can simply check if there is a wall at that origin by creating an entity. If the entity touches anything that means there is another entity at the target origin and you can stuck if you teleport there. You can use that information however you want You can abort teleportation or you can teleport targets near. It is up to you.
Lol, use a trace.
__________________
HamletEagle is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 01-06-2015 , 04:05   Re: [Help] Teleport and entity
Reply With Quote #9

Quote:
1. Negate Vel[0] to Vel[2] you mean Vel[0] = Vel[2] or Vel[2] = Vel[0] ?
Oh, by that I meant:
PHP Code:
Vel[0] = Vel[0]*-1.0
Vel
[1] = Vel[1]*-1.0
Vel
[2] = Vel[2]*-1.0 
Quote:
2. Ya I checked at dias's oberon boss and it works fine but how to remove the entity at newround ?
PHP Code:
remove_entity(iIndex)
remove_entity_name(const eName[]) 
RateX is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 01-06-2015 , 10:03   Re: [Help] Teleport and entity
Reply With Quote #10

@RateX
Thanks

@akcaliberg
how to check an entity touches anything? I'm new in these stuff
__________________
Shiina.Mashiro 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 15:32.


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