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

Player-Teleport (sm_goto, sm_bring)


Post New Thread Reply   
 
Thread Tools Display Modes
-=Leb=-
SourceMod Donor
Join Date: Dec 2008
Location: Sweden/Stockholm
Old 12-07-2010 , 12:45   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #21

Can you add noclip to it while you are teleporting players to you or teleporting to someone. I mean if you are camping inside a room and you want to teleport someone to you who is outside the room, they will stuck on the walls. Also if you could add noblock for 10 seconds when you use /bring or /goto.
You can take a look at this one

http://addons.eventscripts.com/addon...admin_teleport
-=Leb=- is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 12-08-2010 , 09:46   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #22

Quote:
Originally Posted by -=Leb=- View Post
you want to teleport someone to you who is outside the room, they will stuck on the walls.
I dont have that problem, are you sure?
Groger is offline
-=Leb=-
SourceMod Donor
Join Date: Dec 2008
Location: Sweden/Stockholm
Old 12-10-2010 , 10:16   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #23

yea, they get teleported a bit away from you
-=Leb=- is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 12-10-2010 , 10:59   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #24

you do know that they are being teleported to where you aim ? just te make sure
Groger is offline
-=Leb=-
SourceMod Donor
Join Date: Dec 2008
Location: Sweden/Stockholm
Old 12-11-2010 , 12:43   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #25

damn, you have right lol. never had a thought about this lol thx for the info.
-=Leb=- is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 12-11-2010 , 14:26   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #26

Haha good to see its "solved" now
Groger is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 12-14-2010 , 00:24   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #27

This is a great plugin! But I thought it lacked the @all/@red/@blue etc because I sometimes needed to teleport multiple targets into my crosshair so I can destory the crap outta them.

So I added that feature to your already-kickass plugin!

This is for TF2

NOTE: I know this is terribly coded. I'm not familiar with all SM functions like ProcessStringTarget so the coding is very inefficient and pretty embarassing
Attached Files
File Type: sp Get Plugin or Get Source (sm_goto_m2_edit.sp - 1359 views - 7.7 KB)
__________________
M249-M4A1 is offline
LANrat
Junior Member
Join Date: Jan 2009
Old 09-28-2011 , 18:06   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #28

Is there anyone who can make this plugin require a certain admin flag to use it?
__________________
LANrat is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 09-29-2011 , 04:55   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #29

it allready does that, it requires admin flag slay.
Groger is offline
dcx2
Senior Member
Join Date: Sep 2011
Old 01-02-2012 , 23:47   Re: Player-Teleport (sm_goto, sm_bring)
Reply With Quote #30

Hi HyperKiLLeR,

Thank you for your teleportation plugin. Yours is the only version with a goto, which is a feature I wanted. It mostly works for L4D2. I say mostly because if you aim at a wall or a ceiling they will become stuck.

I had an idea. Get the collision point, and then do a bounds check with the client mins/maxs. If the player would become stuck, walk the ray backwards a little bit and try it again, until you collide with yourself or you've taken 100 steps. If you can't succeed, try again from the feet; this allows you to hit the ceiling. If that fails too, then they teleport to you, much like sm_goto.

I also wanted to change to a MASK_SHOT filter for collision, so I can teleport through fences and stuff like that. And I wanted ProcessTargetString support.

So I made these modifications and tested them and they work for me on my L4D2 server. I am sharing them with you in case you wish to add them to your plugin.

I think the backwards-ray-tracing with slightly inflated bounding box idea is cool enough that I'll share that bit in-line so that forum searches can find it. It might help some other people trying to teleport stuff without letting it get stuck.

PHP Code:
// Traces forward from a client's eye or foot position until the ray hits MASK_SHOT
// Then checks for the possibility to get stuck.  If teleportee would get stuck,
// walk the ray backwards little by little until they won't get stuck anymore
// If we get too close to the client's position, or we take 100 steps, fail with client pos
stock bool:GetCollisionPoint(clientFloat:pos[3], bool:eyes=true)
{
    
decl Float:vOrigin[3], Float:vAngles[3], Float:vBackwards[3];
    new 
bool:failed false;
    new 
loopLimit 100;    // only check 100 times, as a precaution against runaway loops

    
if (eyes)
    {
        
GetClientEyePosition(clientvOrigin);
    }
    else
    {
        
// if eyes is false, fall back to the AbsOrigin ( = feet)
        
GetClientAbsOrigin(clientvOrigin);
    }
    
    
GetClientEyeAngles(clientvAngles);
    
GetAngleVectors(vAnglesvBackwardsNULL_VECTORNULL_VECTOR);
    
NormalizeVector(vBackwardsvBackwards);
    
ScaleVector(vBackwards10.0);    // TODO: percentage of distance from endpoint to eyes instead of fixed distance?
    
    
new Handle:trace TR_TraceRayFilterEx(vOriginvAnglesMASK_SHOTRayType_InfiniteTraceEntityFilterPlayer);
        
    if (
TR_DidHit(trace))
    {    
        
TR_GetEndPosition(postrace);
        
//PrintToChat(client, "endpos %f %f %f", pos[0], pos[1], pos[2]);
        
        
while (IsPlayerStuck(posclient) && !failed)    // iteratively check if they would become stuck
        
{
            
SubtractVectors(posvBackwardspos);        // if they would, subtract backwards from the position
            //PrintToChat(client, "endpos %f %f %f", pos[0], pos[1], pos[2]);
            
if (GetVectorDistance(posvOrigin) < 10 || loopLimit-- < 1)
            {
                
                
failed true;    // If we get all the way back to the origin without colliding, we have failed
                //PrintToChat(client, "failed to find endpos");
                
pos vOrigin;    // Use the client position as a fallback
            
}
        }
    }
    
    
CloseHandle(trace);
    return !
failed;        // If we have not failed, return true to let the caller know pos has teleport coordinates
}

#define BOUNDINGBOX_INFLATION_OFFSET 3

// Checks to see if a player would collide with MASK_SOLID (i.e. they would be stuck)
// Inflates player mins/maxs a little bit for better protection against sticking
// Thanks to andersso for the basis of this function
stock bool:IsPlayerStuck(Float:pos[3], client)
{
    new 
Float:mins[3];
    new 
Float:maxs[3];

    
GetClientMins(clientmins);
    
GetClientMaxs(clientmaxs);
    
    
// inflate the sizes just a little bit
    
for (new i=0i<sizeof(mins); i++)
    {
        
mins[i] -= BOUNDINGBOX_INFLATION_OFFSET;
        
maxs[i] += BOUNDINGBOX_INFLATION_OFFSET;
    }

    
TR_TraceHullFilter(posposminsmaxsMASK_SOLIDTraceEntityFilterPlayerclient);

    return 
TR_DidHit();
}  

// filter out players, since we can't get stuck on them
public bool:TraceEntityFilterPlayer(entitycontentsMask)
{
    return 
entity <= || entity MaxClients;

Attached Files
File Type: sp Get Plugin or Get Source (sm_gotoRevA.sp - 910 views - 6.6 KB)

Last edited by dcx2; 01-02-2012 at 23:49. Reason: forgot to attach script
dcx2 is offline
Reply


Thread Tools
Display Modes

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 08:37.


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