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

[BUG] Teleport


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 04-05-2013 , 13:11   [BUG] Teleport
Reply With Quote #1

I just didn't know where to start search, because when I wrote my keywords in the search
I found dozens of threads about teleport which asks for something I don't want.

So you everybody knows teleport problem, when I press teleport key I go off-map when I'm aiming at the sky, It's usually map problem, and I found a solution which isn't suitable, Not be able to aim at the sky and teleport, so I want a handy solution that allow to aim at sky but you will only go to the last point where the map ends, you can't go furthur.

Help please I'll be glad.

Last edited by Moody92; 04-05-2013 at 13:13.
Moody92 is offline
didoWEE
Senior Member
Join Date: Oct 2012
Location: Bulgaria
Old 04-05-2013 , 13:16   Re: [BUG] Teleport
Reply With Quote #2

post code
didoWEE is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 04-05-2013 , 13:25   Re: [BUG] Teleport
Reply With Quote #3

PHP Code:
TeleportPlayeriPlayer )
{
    new 
origin], aim]
    
get_user_originiPlayerorigin )
    
get_user_originiPlayeraim)

    if(-
50>aim[0]-origin[0]>50)            //only change it if they are at least that far away
        
aim[0] += ( ( aim[0] - origin[0] > ) ? -50 50 );
    if(-
50>aim[1]-origin[1]>50)            //only change it if they are at least that far away
        
aim[1] += ( ( aim[1] - origin[1] > ) ? -50 50 );
    if(-
50>aim[2]-origin[2]>50)            //only change it if they are at least that far away
        
aim[2] += ( ( aim[2] - origin[2] > ) ? -50 50 );
    else
        
aim[2] += 40;
    
set_user_originiPlayeraim )
    
UnStuckiPlayer )
    
    return 
true


Last edited by Moody92; 04-05-2013 at 13:28.
Moody92 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-06-2013 , 14:41   Re: [BUG] Teleport
Reply With Quote #4

Seems to work fine, could be improved for sure but i suck hard at 3d geometry.

Edit : i hadn't read accurately what you wrote, so this won't work, i have an idea though

PHP Code:
#include <amxmodx>
#include <xs>
#include <engine>
#include <fakemeta_stocks>

#define PLUGIN "Teleport to Aim Point"
#define VERSION "0.0.1"

const Float:MAX_TELEPORT_Z 125.0 // approximative height from where you can fall without taking any damage.

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )

    
register_clcmd("drop""ClientCommand_drop")
}

public 
ClientCommand_dropid )
{
    if( 
get_user_weapon(id) == CSW_KNIFE )
    {
        
TeleportToAimPointid )
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

TeleportToAimPointid )
{
    new 
Float:coordOrigin[3], Float:coordDest[3], Float:flFractionFloat:vecPlaneNormal[3], Float:vecTemp[3]

    
pev(idpev_origincoordOrigin)
    
coordOrigin[2] += pev(idpev_flags) & FL_DUCKING 12.0 18.0

    velocity_by_aim
(id9999coordDest)
    
xs_vec_add(coordDestcoordOrigincoordDest)

    
trace_normal(idcoordOrigincoordDestvecPlaneNormal)

    
trace_line(idcoordOrigincoordDestcoordDest)
    
traceresult(TR_FractionflFraction)
    
    if( 
flFraction >= 1.0 || point_contentscoordDest ) == CONTENTS_SKY )
    {
        return 
0
    
}

    new const 
Float:maxs[3] = { 16.0,  16.0,  36.0};
    new 
i

    
for(i=0i<3i++)
    {
        
vecTemp[i] = vecPlaneNormal[i] * maxs[i]
    }
    
xs_vec_add(coordDestvecTempcoordDest)

    
vecTemp[0] = coordDest[0]
    
vecTemp[1] = coordDest[1]
    
vecTemp[2] = coordDest[2] - maxs[2]

    
trace_line(idcoordDestvecTempvecTemp)

    new 
Float:flDist coordDest[2] - vecTemp[2]
    if( 
flDist maxs[2] )
    {
        
vecTemp[2] += maxs[2]
        if( !
trace_hull(vecTempHULL_HUMAN) )
        {
            
xs_vec_copy(vecTempcoordDest)
            goto 
CheckHeight
        
}
        return 
0
    
}
    
    if( 
trace_hull(coordDestHULL_HUMAN) )
    {
        return 
0
    
}

CheckHeight:
    
vecTemp[0] = coordDest[0]
    
vecTemp[1] = coordDest[1]
    
vecTemp[2] = coordDest[2] - 9999.0

    engfunc
(EngFunc_TraceHullcoordDestvecTempDONT_IGNORE_MONSTERSHULL_HUMANFM_NULLENT0)
    
get_tr2(0TR_flFractionflFraction)
    
flFraction *= 9999.0
    flFraction 
-= maxs[2]
    if( 
flFraction MAX_TELEPORT_Z )
    {
        return 
0
    
}

    
Util_TE_TELEPORT(coordOrigin)
    
Util_TE_TELEPORT(coordDest)

    
entity_set_origin(idcoordDest)
    return 
1
}

Util_TE_TELEPORT( const Float:origin[3] )
{
    
EF_MessageBegin(MSG_PVSSVC_TEMPENTITYorigin0)
    
write_byte(TE_TELEPORT)
    
EF_WriteCoord(origin[0])
    
EF_WriteCoord(origin[1])
    
EF_WriteCoord(origin[2])
    
message_end()

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-06-2013 at 16:44.
ConnorMcLeod is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 04-06-2013 , 18:28   Re: [BUG] Teleport
Reply With Quote #5

I guess this would do the job.

Thanks alot, appreciate it.
Moody92 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 05:28.


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