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

[req] teleport to crosshair destination


Post New Thread Reply   
 
Thread Tools Display Modes
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 06-20-2018 , 18:27   Re: [req] teleport to crosshair destination
Reply With Quote #11

LenHard, everything works totally fine, but if i can ask second time - as i said at beginning, can u make this teleport not for full lenght forigin, but for 300 units f.e. I need this because it will be a class for COD, which will be able to gain more intelligence = raise lenght of teleport.
hope you'll understand me, thanks in advance, you're great
supertimor is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 06-26-2018 , 02:12   Re: [req] teleport to crosshair destination
Reply With Quote #12

Bump guys, i still need help :/
supertimor is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 06-30-2018 , 01:51   Re: [req] teleport to crosshair destination
Reply With Quote #13

Quote:
Originally Posted by supertimor View Post
LenHard, everything works totally fine, but if i can ask second time - as i said at beginning, can u make this teleport not for full lenght forigin, but for 300 units f.e. I need this because it will be a class for COD, which will be able to gain more intelligence = raise lenght of teleport.
hope you'll understand me, thanks in advance, you're great
Change this
PHP Code:
public Action Cmd_Teleport(int clientint args

    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client)) 
    { 
        
float fPos[3], fBackwards[3]; 
        
float fOrigin[3]; GetClientEyePosition(clientfOrigin);  
        
float fAngles[3]; GetClientEyeAngles(clientfAngles); 
         
        
Handle trace TR_TraceRayFilterEx(fOriginfAnglesMASK_PLAYERSOLIDRayType_InfiniteTraceRayDontHitPlayersclient); 
         
        
bool failed
         
        
int loopLimit 100
         
        
GetAngleVectors(fAnglesfBackwardsNULL_VECTORNULL_VECTOR); 
        
NormalizeVector(fBackwardsfBackwards); 
        
ScaleVector(fBackwards10.0);  
         
        if (
TR_DidHit(trace)) 
        { 
            
TR_GetEndPosition(fPostrace); 
             
            while (
IsPlayerStuck(fPosclient) && !failed
            { 
                
SubtractVectors(fPosfBackwardsfPos);  
                 
                if (
GetVectorDistance(fPosfOrigin) < 10 || loopLimit-- < 1
                { 
                    
failed true
                    
fPos fOrigin;    
                } 
            } 
        } 
        
delete trace
         
        
TeleportEntity(clientfPosNULL_VECTORNULL_VECTOR); 
        
PrintCenterText(client"You have teleported!"); 
    } 
    return 
Plugin_Handled

To
PHP Code:
#define DISTANCE 500.0

public Action Cmd_Teleport(int clientint args)
{
    if (
client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
float fPos[3], fBackwards[3];
        
float fOrigin[3]; GetClientEyePosition(clientfOrigin); 
        
float fAngles[3]; GetClientEyeAngles(clientfAngles);
        
GetAngleVectors(fAnglesfBackwardsNULL_VECTORNULL_VECTOR);
        
        for (
int i 03; ++i) {
            
fAngles[i] = fOrigin[i] + (fBackwards[i] * DISTANCE);
        }
        
        
Handle hTrace TR_TraceRayFilterEx(fOriginfAnglesMASK_PLAYERSOLIDRayType_EndPointTraceRayDontHitPlayers);
        
        
int loopLimit 100;
        
        if (
TR_DidHit(hTrace))
        {            
            
TR_GetEndPosition(fPoshTrace);
            
            
NormalizeVector(fBackwardsfBackwards);
            
ScaleVector(fBackwards10.0); 
            
            while (
IsPlayerStuck(fPosclient))
            {
                
SubtractVectors(fPosfBackwardsfPos); 
                
                if (
GetVectorDistance(fPosfOrigin) < 10 || loopLimit-- < 1)
                {
                    
fPos fOrigin;   
                    break;
                }
            }
        }
        else 
fPos fAngles;
        
delete hTrace;
        
        
TeleportEntity(clientfPosNULL_VECTORNULL_VECTOR);
        
PrintCenterText(client"You have teleported!");
    }
    return 
Plugin_Handled;

__________________
LenHard 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 04:39.


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