Raised This Month: $ Target: $400
 0% 

Origin Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 01-18-2006 , 06:00   Origin Help
Reply With Quote #1

Im thinking of making a modified teleport plugin where it teleports you about 100-200 units in front of where you are looking, but doesnt change your height (z-axis). But Im having trouble figuring out how to calculate the origin to teleport to. Can anyone help with this?
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 01-18-2006 , 06:12  
Reply With Quote #2

Could you post the code you have so far, please?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 01-18-2006 , 08:07  
Reply With Quote #3

This is pretty simple mathematical task.
Get player origin and angle and then calculate the 'x' and 'y' increments with trigonometrical functions and add each to corresponding player's origin component.
VEN is offline
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 01-18-2006 , 09:24  
Reply With Quote #4

This is what I have so far. And I know it isnt anywhere near correct.
Attached Files
File Type: sma Get Plugin or Get Source (teletest.sma - 981 views - 716 Bytes)
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
VEN
Veteran Member
Join Date: Jan 2005
Old 01-18-2006 , 10:50  
Reply With Quote #5

If i undestand you correctly you want teleport player on certain distance in aiming direction? Or on certain distance from "end position from eyes (hit point for weapon)"?
VEN is offline
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 01-18-2006 , 10:56   Re: Origin Help
Reply With Quote #6

Quote:
Originally Posted by Willmaker
where it teleports you about 100-200 units in front of where you are looking, but doesnt change your height (z-axis). ?
Basically, teleports you a short distance in front of where you are aiming.

eg, If your standing up against a locked door, using this command, it will teleport you to the other side of it.
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
VEN
Veteran Member
Join Date: Jan 2005
Old 01-18-2006 , 11:06  
Reply With Quote #7

1. Get player's origin and angles (entity_get_vector)
2. Calculate the 'x' and 'y' origin increments with trigonometrical functions (floatcos and floatsin).
3. Add each increment to corresponding player's current origin's component.
VEN is offline
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 01-19-2006 , 10:44  
Reply With Quote #8

Quote:
Originally Posted by VEN
1. Get player's origin and angles (entity_get_vector)
2. Calculate the 'x' and 'y' origin increments with trigonometrical functions (floatcos and floatsin).
3. Add each increment to corresponding player's current origin's component.
I have no experience with entity_get_vector's or floatcos etc. Would you mind giving me an example?

Edit: Nevermind. I found what I needed here. Thanks.
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
KoST
Senior Member
Join Date: Jul 2005
Old 01-19-2006 , 16:40  
Reply With Quote #9

try this..

Code:
#include <amxmodx> #include <amxmisc> #include <engine> public plugin_init(){     register_plugin("Test","0.1","Willmaker")     register_clcmd("say !tele", "admin_tele", ADMIN_LEVEL_C," - Tele short distance in front") } public admin_tele(id,level,cid){     if(!cmd_access(id,level,cid,1)){         return PLUGIN_HANDLED     }         new distance=100 // here you can adjust teleport distance     new Float:originalSpot[3],Float:aimVec[3]     // the same as get_user_origin(id,origin,0), except that originalSpot is returned as float     entity_get_vector(id,EV_VEC_origin,originalSpot)         // get a vector in the direction the player is looking     VelocityByAim(id,distance,aimVec)     // only use x and y coordinates     originalSpot[0] += aimVec[0] // is the same as originalSpot[0] = originalSpot[0] + aimVec[0]     originalSpot[1] += aimVec[1]     // the same as set_user_origin(id,origin), except that originalSpot is float here     entity_set_vector(id,EV_VEC_origin,originalSpot)     return PLUGIN_HANDLED }
KoST 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 20:24.


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