Raised This Month: $ Target: $400
 0% 

Teleport radius


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Tonda
Senior Member
Join Date: Aug 2009
Old 11-26-2010 , 07:03   Teleport radius
Reply With Quote #1

Hi all, i need radius to teleport. With this script you can teleport from map star to map end. I need teleport with max radius, and if you try teleport more than radius, you obtained message with warning.

Code:
public ActivateTeleport(id)
{
 
 if (hasTeleport[id])
 {
 // Get old and new location
 new OldLocation[3], NewLocation[3];
 
 // Get current players location
 get_user_origin(id, OldLocation);
 
 // Get location where player is aiming(where he will be teleported)
 get_user_origin(id, NewLocation, 3);
 
 // Create bubbles in a place where player teleported
 // First, get user origin
 new UserOrigin[3];
 get_user_origin(id, UserOrigin);
 
 // Now create bubbles
 new BubbleOrigin[3];
 BubbleOrigin[0] = UserOrigin[0];
 BubbleOrigin[1] = UserOrigin[1];
 BubbleOrigin[2] = UserOrigin[2] + 40;
 
 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
 write_byte(TE_SPRITETRAIL) // TE ID
 write_coord(BubbleOrigin[0]) // Start Position X
 write_coord(BubbleOrigin[1]) // Start Position Y
 write_coord(BubbleOrigin[2]) // Start Position Z
 write_coord(UserOrigin[0]) // End Position X
 write_coord(UserOrigin[1]) // End Position Y
 write_coord(UserOrigin[2]) // End Position Z
 write_short(BubbleSprite) // Sprite Index
 write_byte(30) // Count
 write_byte(10) // Life
 write_byte(1) // Scale
 write_byte(50) // Velocity Along Vector
 write_byte(10) // Rendomness of Velocity
 message_end();
 
 
 // Player cannot stuck in the wall/floor
 NewLocation[0] += ((NewLocation[0] - OldLocation[0] > 0) ? -50 : 50);
 NewLocation[1] += ((NewLocation[1] - OldLocation[1] > 0) ? -50 : 50);
 NewLocation[2] += 40;
 
 // Teleport player
 set_user_origin(id, NewLocation);
 
 hasTeleport[id] = false;
 
 message_begin(MSG_ONE_UNRELIABLE, g_msgFade, .player=id);
 write_short( 1<<13 );
 write_short( 1<<5 );
 write_short( FFADE_IN );
 write_byte( 255 );
 write_byte( 255 );
 write_byte( 255 );
 write_byte( 75 );
 message_end();
 
 }
 
 return PLUGIN_CONTINUE;
}
Tonda is offline
 



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 11:14.


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