AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Teleport (https://forums.alliedmods.net/showthread.php?t=54989)

Alka 05-10-2007 10:37

Teleport
 
Hi.I have this plugin that teleport an player,where he aim!But when i'm teleporting i'm stuck in wall! I think i should use trace_line,to block player when he hit wall, but dunno how to do that...

Code:

#include <amxmodx>
#include <fun>
 
#define PLUGIN "Teleport"
#define VERSION "1.0"
#define AUTHOR "Alka"
 
public plugin_init() {
 
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /teleport","cmd_teleport");
}
public cmd_teleport(id) {
 
  new origin[3]
  get_user_origin(id,origin,3)
 
  set_user_origin(id,origin)
}

Can someone show me how to do that?
Thanks...

VEN 05-10-2007 12:48

Re: Teleport
 
Works fine for walls. Still need to handle floor/ceiling/corner situations but i do not have a time.
Code:
#include <amxmodx> #include <fakemeta> #include <xs> public plugin_init() {         register_concmd("tst", "func") } public func(id) {         static Float:start[3], Float:dest[3]         pev(id, pev_origin, start)         pev(id, pev_view_ofs, dest)         xs_vec_add(start, dest, start)         pev(id, pev_v_angle, dest)         engfunc(EngFunc_MakeVectors, dest)         global_get(glb_v_forward, dest)         xs_vec_mul_scalar(dest, 9999.0, dest)         xs_vec_add(start, dest, dest)         engfunc(EngFunc_TraceLine, start, dest, IGNORE_MONSTERS, id, 0)         get_tr2(0, TR_vecEndPos, start)         get_tr2(0, TR_vecPlaneNormal, dest)         static const player_hull[] = {HULL_HUMAN, HULL_HEAD}         engfunc(EngFunc_TraceHull, start, start, DONT_IGNORE_MONSTERS, player_hull[_:!!(pev(id, pev_flags) & FL_DUCKING)], id, 0)         if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen)) {                 engfunc(EngFunc_SetOrigin, id, start)                 return PLUGIN_HANDLED         }         static Float:size[3]         pev(id, pev_size, size)         xs_vec_mul_scalar(dest, (size[0] + size[1]) / 2.0, dest)         xs_vec_add(start, dest, dest)         engfunc(EngFunc_SetOrigin, id, dest)         return PLUGIN_HANDLED }

Alka 05-10-2007 13:12

Re: Teleport
 
Thanks VEN...it's working! :wink: but when you have time,i want to block teleport to floor to! :P

regalis 05-10-2007 13:33

Re: Teleport
 
Quote:

Originally Posted by VEN (Post 475334)
Works fine for walls. Still need to handle floor/ceiling/corner situations but i do not have a time.
Code:
#include <amxmodx> #include <fakemeta> #include <xs> public plugin_init() { register_concmd("tst", "func") } public func(id) { static Float:start[3], Float:dest[3] pev(id, pev_origin, start) pev(id, pev_view_ofs, dest) xs_vec_add(start, dest, start) pev(id, pev_v_angle, dest) engfunc(EngFunc_MakeVectors, dest) global_get(glb_v_forward, dest) xs_vec_mul_scalar(dest, 9999.0, dest) xs_vec_add(start, dest, dest) engfunc(EngFunc_TraceLine, start, dest, IGNORE_MONSTERS, id, 0) get_tr2(0, TR_vecEndPos, start) get_tr2(0, TR_vecPlaneNormal, dest) static const player_hull[] = {HULL_HUMAN, HULL_HEAD} engfunc(EngFunc_TraceHull, start, start, DONT_IGNORE_MONSTERS, player_hull[_:!!(pev(id, pev_flags) & FL_DUCKING)], id, 0) if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen)) { engfunc(EngFunc_SetOrigin, id, start) return PLUGIN_HANDLED } static Float:size[3] pev(id, pev_size, size) xs_vec_mul_scalar(dest, (size[0] + size[1]) / 2.0, dest) xs_vec_add(start, dest, dest) engfunc(EngFunc_SetOrigin, id, dest) return PLUGIN_HANDLED }

OMFG! I would need a year to code this or maybe forever *lol*
I heard that you will make another nice tutorial about that :mrgreen:

Great!
greetz regalis

Styles 05-10-2007 16:58

Re: Teleport
 
when you have time ven could you please explain that. FakeMeta is very hard for me and I would Love to learn it.

regalis 05-10-2007 18:18

Re: Teleport
 
Quote:

Originally Posted by styles (Post 475411)
when you have time ven could you please explain that. FakeMeta is very hard for me and I would Love to learn it.

I second that!!

_lol_ 04-23-2009 14:38

Re: Teleport
 
when i aim at the floor and teleport my y get stuck on the floor...why?

SnoW 04-23-2009 15:02

Re: Teleport
 
Quote:

Originally Posted by _lol_ (Post 812486)
when i aim at the floor and teleport my y get stuck on the floor...why?

If you actually read the thread before posting you would know that it doesn't work for floor, but only walls. Actually it was said many times lol.
Quote:

Originally Posted by styles (Post 475411)
FakeMeta is very hard for me and I would Love to learn it.

Wow that's long time ago. :mrgreen:


All times are GMT -4. The time now is 06:37.

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