AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   DeathRun Teleport (https://forums.alliedmods.net/showthread.php?t=297907)

SXJ Team. 05-27-2017 08:06

DeathRun Teleport
 
3 Attachment(s)
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]"


Ayman Khaled 05-27-2017 10:39

Re: DeathRun Teleport
 
are you deniS ?

Snake. 07-24-2017 13:08

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

Snake. 08-30-2018 15:44

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

JocAnis 09-03-2018 15:09

Re: DeathRun Teleport
 
@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;
}


JocAnis 03-30-2020 13:58

Re: DeathRun Teleport
 
Code above is updated and all fixed, have fun

dzoni123 08-25-2022 11:16

Re: DeathRun Teleport
 
It does not work. It won't teleport terrorist.

Pejic99 03-16-2024 01:59

Re: DeathRun Teleport
 
Quote:

Originally Posted by JocAnis (Post 2689468)
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 ?


All times are GMT -4. The time now is 09:54.

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