Raised This Month: $32 Target: $400
 8% 

[req] teleport to crosshair destination


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 06-16-2018 , 09:19   [req] teleport to crosshair destination
Reply With Quote #1

Hi!
Can someone write simple code, to teleport myself to place where i'am aiming? Not max lenght, but for example for 300 unites, with collision point (if there's a wall -10 units or something) or if player will be stuck after teleport - teleport back
help me guys pls
supertimor is offline
alex123pavlov
Member
Join Date: Jun 2018
Location: Moscow
Old 06-16-2018 , 11:55   Re: [req] teleport to crosshair destination
Reply With Quote #2

2$
alex123pavlov is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 06-16-2018 , 12:23   Re: [req] teleport to crosshair destination
Reply With Quote #3

go on, put here .smx on command and i need test if it works
supertimor is offline
alex123pavlov
Member
Join Date: Jun 2018
Location: Moscow
Old 06-16-2018 , 13:29   Re: [req] teleport to crosshair destination
Reply With Quote #4

full afterwards (write alex123)

Last edited by RedSword; 06-17-2018 at 08:39.
alex123pavlov is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 06-16-2018 , 17:49   Re: [req] teleport to crosshair destination
Reply With Quote #5

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
RegConsoleCmd("sm_tp"Cmd_Teleport"Teleports you at where you aim");    
}

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;
}

bool IsPlayerStuck(float pos[3], int client)
{
    
float mins[3]; GetClientMins(clientmins);
    
float maxs[3]; GetClientMaxs(clientmaxs);
    
    for (
int i 03; ++i)
    {
        
mins[i] -= 3;
        
maxs[i] += 3;
    }

    
TR_TraceHullFilter(posposminsmaxsMASK_SOLIDTraceRayDontHitPlayersclient);
    return 
TR_DidHit();
}  

public 
bool TraceRayDontHitPlayers(int iEntityint iMaskany iData)
{
    if (
iEntity <= MaxClients)
        return 
false;
    return 
true;

Try this
Attached Files
File Type: sp Get Plugin or Get Source (Teleport.sp - 360 views - 1.9 KB)
__________________

Last edited by LenHard; 06-16-2018 at 17:51.
LenHard is offline
Zyten
Senior Member
Join Date: Jan 2018
Old 06-16-2018 , 18:25   Re: [req] teleport to crosshair destination
Reply With Quote #6

i am using this https://forums.alliedmods.net/showthread.php?p=2323724 for example u want to tp yourself /bring super . you will be tp to your crosshair
Zyten is offline
zwetch
Senior Member
Join Date: Aug 2015
Location: South Africa
Old 06-17-2018 , 03:39   Re: [req] teleport to crosshair destination
Reply With Quote #7

Lol this plugin is crazy fun, thanks for the share! (would be better if there was a option to set the amount of time between teleports tho) So player cant just abuse the shit outa it lol.
__________________
https://forums.alliedmods.net/signaturepics/sigpic262740_1.gif

Last edited by zwetch; 06-17-2018 at 03:49.
zwetch is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 06-17-2018 , 08:40   Re: [req] teleport to crosshair destination
Reply With Quote #8

Quote:
Originally Posted by alex123pavlov View Post
full afterwards (write alex123)
Removed attachment as no source is provided.
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work
RedSword is offline
supertimor
AlliedModders Donor
Join Date: Sep 2017
Old 06-20-2018 , 12:28   Re: [req] teleport to crosshair destination
Reply With Quote #9

Love u, LenHard. I've got nothing more to say <3
supertimor is offline
jillchang917
Member
Join Date: Dec 2017
Old 06-20-2018 , 14:11   Re: [req] teleport to crosshair destination
Reply With Quote #10

Quote:
Originally Posted by alex123pavlov View Post
2$
... what's the point of charging $2? plugin exists anyways.

Here is the one I use that gives some extra functionality that I feel is necessary. Thanks to htcarnage for making it.
https://forums.alliedmods.net/showthread.php?p=2004356
Hope that helps.


oh nvm, it doesn't teleport where you aim. I'll leave this anyways just incase.

Last edited by jillchang917; 06-20-2018 at 14:12. Reason: elaboration
jillchang917 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 23:49.


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