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

DeathRun Teleport


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
SXJ Team.
Junior Member
Join Date: Jun 2014
Old 05-27-2017 , 08:06   DeathRun Teleport
Reply With Quote #1

DeathRun Teleport v1.0 by deniS

Released 27.05.2017

If CT finish the map in end of the map he press button and TT will be teleported there.

Version 1.0 First release!

* Cvars:

deathrun_teleport_delay 5.0 - Delay after using.

* Say Commands:

say /teleport - Display Teleport Menu

* In Menu:

•• Create Button
•• Rotate Button
•• Set Teleport Position
•• Save Button & Teleport Position


* Models:

•• Default Button Model, change if you want:
PHP Code:
 models/deathrun/teleport_button.mdl 


* Prefix:

•• To change prefix, Edit
PHP Code:
new const g_sPrefix[ ] = "[DeathRun]"
Attached Files
File Type: sma Get Plugin or Get Source (deathrun_teleport.sma - 1069 views - 8.4 KB)
File Type: inc colorchat.inc (2.5 KB, 358 views)
File Type: zip Button_Model.zip (3.3 KB, 220 views)

Last edited by SXJ Team.; 05-27-2017 at 08:09.
SXJ Team. is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 05-27-2017 , 10:39   Re: DeathRun Teleport
Reply With Quote #2

are you deniS ?
__________________
Ayman Khaled is offline
Snake.
Senior Member
Join Date: Jul 2017
Old 07-24-2017 , 13:08   Re: DeathRun Teleport
Reply With Quote #3

Hi, i dont know why but it does not work for me.Are there something wrong on plugin or is that my fault ?

Last edited by Snake.; 07-24-2017 at 13:09.
Snake. is offline
Send a message via Skype™ to Snake.
Snake.
Senior Member
Join Date: Jul 2017
Old 08-30-2018 , 15:44   Re: DeathRun Teleport
Reply With Quote #4

This plugin does not save the buttons. Can anyone fix it and can add "delete the buttons" option to menu ?

Last edited by Snake.; 08-30-2018 at 16:04.
Snake. is offline
Send a message via Skype™ to Snake.
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-03-2018 , 15:09   Re: DeathRun Teleport
Reply With Quote #5

@Snake. here you are..but change prefix and set proper model location...it worked for me

Code:
#include < amxmodx > 
#include < amxmisc > 
#include < fakemeta > 
#include < engine > 
#include < hamsandwich > 
#include < colorchat > 

//#pragma tabsize 0 
//#pragma semicolon 1 

new MapName[32]
new g_SpawnFile[256]
new const g_sPluginInfo[ ][ ] = 
{ 
    "DR TP", 
    "1.1", 
    "deniS" 
}; 

new const g_sPrefix[ ] = "[Deathrun]"; 

new const g_sButtonModel[ ] = "models/deathrun/timer/teleport_button.mdl"; 

new g_pFuncButton, g_pDelayCvar; 

new g_iButton; 
new g_iButtonAngle; 
new const Float: g_fButtonAngles[ 4 ] = 
{ 
    90.0, 
    180.0, 
    270.0, 
    360.0 
}; 
new Float: g_fButtonOrigin[ 3 ]; 
new Float: g_fPlayerOrigin[ 3 ]; 
new Float: g_fPlayerDelay[ 33 ]; 
new Float: g_fGameTimeCheck; 

public plugin_init( ) 
{ 
    register_plugin 
    ( 
        g_sPluginInfo[ 0 ], 
        g_sPluginInfo[ 1 ], 
        g_sPluginInfo[ 2 ] 
    ); 
     
    register_clcmd( "say /teleport", "DTBM" ); 
    register_clcmd( "say_team /teleport", "DTBM" ); 
     
    g_pDelayCvar = register_cvar( "deathrun_teleport_delay", "5.0" ); 
     
    RegisterHam( Ham_Use, "func_button", "fwButtonUsed" ); 
     
    LoadBTP( ); 
} 
public plugin_precache( ) 
{ 
    precache_model( g_sButtonModel ); 
     
    g_pFuncButton = engfunc( EngFunc_AllocString, "func_button" ); 
    new configdir[128]
	get_configsdir(configdir, 127 )
	new spawndir[256]
	format(spawndir,255,"%s/dr_tr",configdir)
	
	if (!dir_exists(spawndir))
	{
		if (mkdir(spawndir)==0)
		{
			log_amx("Create [%s] dir successfully finished.",spawndir)
		}
		else
		{
			log_error(AMX_ERR_NOTFOUND,"Couldn't create [%s] dir,plugin stoped.",spawndir)
			pause("ad")
		}	
	}
	get_mapname(MapName, 31)

	format(g_SpawnFile, 255, "%s/%s.txt",spawndir, MapName)
} 
public DTBM( iClient ) 
{ 
    if ( !( get_user_flags( iClient ) & ADMIN_RCON ) ) 
    { 
        ColorChat( iClient, BLUE, "^4%s^1 You don't have access to this command", g_sPrefix ); 
         
        return PLUGIN_HANDLED; 
    } 
    if ( !is_user_alive( iClient ) ) 
    { 
        ColorChat( iClient, BLUE, "^4%s^1 You must be Alive.", g_sPrefix ); 
         
        return PLUGIN_HANDLED; 
    } 
     
    new iMenu = menu_create( "DTB Menu", "DTBM_Handler" ); 
     
    menu_additem( iMenu, "Create button" ); 
    menu_additem( iMenu, "Rotate button" ); 
    menu_additem( iMenu, "Set teleport position" ); 
    menu_additem( iMenu, "Save button & teleport position" ); 
     
    menu_display( iClient, iMenu, 0 ); 
     
    return PLUGIN_HANDLED; 
} 
public DTBM_Handler( iClient, iMenu, iItem ) 
{ 
    if ( iItem == MENU_EXIT ) 
    { 
        menu_destroy( iMenu ); 
         
        return PLUGIN_HANDLED; 
    } 
     
    switch ( iItem ) 
    { 
        case 0: 
        { 
            CreateButton( iClient ); 
             
            DTBM( iClient ); 
        } 
        case 1: 
        { 
            if ( g_iButtonAngle == 3 ) 
                g_iButtonAngle = 0; 
            else 
                g_iButtonAngle++; 
             
            new Float: fButtonAngles[ 3 ]; fButtonAngles[ 1 ] = g_fButtonAngles[ g_iButtonAngle ]; 
            set_pev( g_iButton, pev_angles, fButtonAngles ); 
             
            DTBM( iClient ); 
        } 
        case 2: 
        { 
            if ( !is_user_alive( iClient ) ) { 
                ColorChat( iClient, BLUE, "^4%s^1 You must be Alive.", g_sPrefix ); 
            } 
            new iOrigin[ 3 ]; 
            get_user_origin( iClient, iOrigin ); 
             
            new Float: fOrigin[ 3 ]; 
            IVecFVec( iOrigin, fOrigin ); 
             
            g_fPlayerOrigin[ 0 ] = fOrigin[ 0 ]; 
            g_fPlayerOrigin[ 1 ] = fOrigin[ 1 ]; 
            g_fPlayerOrigin[ 2 ] = fOrigin[ 2 ] + 20.0; 
             
            ColorChat( iClient, BLUE, "^4%s^3 Teleport^1 position has successfully set.", g_sPrefix ); 
             
            DTBM( iClient ); 
        } 
        case 3: 
	{
            SaveBTP(); 
	   }
    } 
     
    return PLUGIN_HANDLED; 
} 
stock CreateButton( iClient, Float: fButtonOrigin[ 3 ] = { 0.0, 0.0, 0.0 } ) 
{ 
    if ( !g_iButton ) 
    { 
        new iEntity = engfunc( EngFunc_CreateNamedEntity, g_pFuncButton ); 
         
        set_pev( iEntity, pev_classname, "DTB" ); 
        set_pev( iEntity, pev_solid, SOLID_BBOX ); 
        set_pev( iEntity, pev_movetype, MOVETYPE_NONE ); 
         
        engfunc( EngFunc_SetModel, iEntity, g_sButtonModel ); 
        engfunc( EngFunc_SetSize, iEntity, Float: { -16.0, -16.0, 0.0 }, Float: { 16.0, 16.0, 60.0 } ); 
         
        g_iButton = iEntity; 
    } 
    if ( iClient ) 
    { 
        new iOrigin[ 3 ]; 
        get_user_origin( iClient, iOrigin, 3 ); 
         
        new Float: fOrigin[ 3 ]; 
        IVecFVec( iOrigin, fOrigin ); 
         
        engfunc( EngFunc_SetOrigin, g_iButton, fOrigin ); 
         
        g_fButtonOrigin[ 0 ] = fOrigin[ 0 ]; 
        g_fButtonOrigin[ 1 ] = fOrigin[ 1 ]; 
        g_fButtonOrigin[ 2 ] = fOrigin[ 2 ]; 
    } 
    else 
    { 
        engfunc( EngFunc_SetOrigin, g_iButton, fButtonOrigin ); 
         
        new Float: fButtonsAngles[ 3 ]; fButtonsAngles[ 1 ] = g_fButtonAngles[ g_iButtonAngle ]; 
        set_pev( g_iButton, pev_angles, fButtonsAngles ); 
    } 
     
    return PLUGIN_HANDLED; 
} 
public SaveBTP( ) 
{ 
    new sMap[ 32 ], sConfig[ 32 ], sMapFile[ 128 ]; 
  
    if (file_exists(g_SpawnFile))
		delete_file(g_SpawnFile)
		
    new sData[ 128 ]; 
         
    formatex( sData, charsmax( sData ), "%f %f %f %i %f %f %f", g_fButtonOrigin[ 0 ], g_fButtonOrigin[ 1 ], g_fButtonOrigin[ 2 ], g_iButtonAngle, g_fPlayerOrigin[ 0 ], g_fPlayerOrigin[ 1 ], g_fPlayerOrigin[ 2 ] ); 
    write_file( g_SpawnFile, sData ); 
     
    ColorChat( 0, BLUE, "^4%s^1 Position for timer and teleport saved.", g_sPrefix ); 
} 
bool: LoadBTP( ) 
{ 

    if ( file_exists( g_SpawnFile ) ) 
    { 
        new sData[ 128 ], iLen, iLine, sButtonOrigin[ 3 ][ 8 ], sButtonAngle[ 2 ], sPlayerOrigin[ 3 ][ 8 ]; 
         
        while( ( iLine = read_file( g_SpawnFile, iLine, sData , charsmax( sData ) , iLen ) ) != 0) 
        { 
            if ( sData[ 0 ] == ';' ) 
                continue; 
         
            parse( sData, sButtonOrigin[ 0 ], 7, sButtonOrigin[ 1 ], 7, sButtonOrigin[ 2 ], 7, sButtonAngle, 2, sPlayerOrigin[ 0 ], 7, sPlayerOrigin[ 1 ], 7, sPlayerOrigin[ 2 ], 7 ); 
             
            g_fButtonOrigin[ 0 ] = str_to_float( sButtonOrigin[ 0 ] ); 
            g_fButtonOrigin[ 1 ] = str_to_float( sButtonOrigin[ 1 ] ); 
            g_fButtonOrigin[ 2 ] = str_to_float( sButtonOrigin[ 2 ] ); 
            g_iButtonAngle = str_to_num( sButtonAngle ); 
            g_fPlayerOrigin[ 0 ] = str_to_float( sPlayerOrigin[ 0 ] ); 
            g_fPlayerOrigin[ 1 ] = str_to_float( sPlayerOrigin[ 1 ] ); 
            g_fPlayerOrigin[ 2 ] = str_to_float( sPlayerOrigin[ 2 ] ); 
             
            CreateButton( 0, g_fButtonOrigin ); 
             
         
        } 
    } 
    else 
    { 
      
         
        return false; 
    } 
     
    return true; 
     
} 
public fwButtonUsed( iEntity, iClient ) 
{ 
    if ( !is_user_alive( iClient ) || get_user_team( iClient ) != 2 || iEntity != g_iButton ) 
        return HAM_IGNORED; 
     
    g_fGameTimeCheck = get_gametime( ); 
     
    if ( g_fPlayerDelay[ iClient ] > g_fGameTimeCheck ) 
    { 
        ColorChat( iClient, BLUE, "^4%s^1 Next use for^3 %.1f^1 seconds.", g_sPrefix, g_fPlayerDelay[ iClient ] - g_fGameTimeCheck ); 
         
        return HAM_IGNORED; 
    } 
     
    static iPlayers[ 32 ], iNum; 
    get_players( iPlayers, iNum, "aeh", "TERRORIST" ); 
     
	if ( !iNum ) 
    { 
        ColorChat( iClient, BLUE, "^4%s^1 No^3 Terrorist^1 detected.", g_sPrefix ); 
         
       return HAM_IGNORED; 
    } 
     
    //engfunc( EngFunc_SetOrigin, iClient, g_fPlayerOrigin ); 
	set_pev(iPlayers[0], pev_origin, g_fPlayerOrigin)
	set_pev(iPlayers[0], pev_velocity, 0.0)
  
     
    g_fPlayerDelay[ iClient ] = g_fGameTimeCheck + get_pcvar_float( g_pDelayCvar ); 
     
    return HAM_IGNORED; 
}

Last edited by JocAnis; 03-30-2020 at 13:57.
JocAnis is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 03-30-2020 , 13:58   Re: DeathRun Teleport
Reply With Quote #6

Code above is updated and all fixed, have fun
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
dzoni123
Junior Member
Join Date: Aug 2022
Old 08-25-2022 , 11:16   Re: DeathRun Teleport
Reply With Quote #7

It does not work. It won't teleport terrorist.
dzoni123 is offline
Pejic99
New Member
Join Date: Mar 2024
Old 03-16-2024 , 01:59   Re: DeathRun Teleport
Reply With Quote #8

Quote:
Originally Posted by JocAnis View Post
Code above is updated and all fixed, have fun
Could you make it so when you have a "fake player" (bot) in the server on TT side so it knows to ignore the bot and teleport the real player ?
Pejic99 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 01:07.


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