AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Free wallhang + team switch (https://forums.alliedmods.net/showthread.php?t=196636)

dr06u 09-23-2012 15:15

Free wallhang + team switch
 
Hello I added furien mod by ConnorMcLeod on my server, everything works fine except the auto switch teams when CT (Anti Furiens) win the round (even if I added in furien.ini SWITCH_TEAMS 1). So I added another plugin that would switch the teams for me that looks like this:

PHP Code:

public ct_win( ) {

    
set_task1.5 ,"SwitchTeams" );

}
public 
SwitchTeams( ) {
    
    new 
iPlayers[32], iNum;
    
get_players(iPlayersiNum"h");

    if( 
iNum 
    {
        new 
id;
        for(--
iNumiNum>=0iNum--) 
        {
            
id iPlayers[iNum];
            switch( 
cs_get_user_team(id) ) 
            {
                case 
CS_TEAM_Tcs_set_user_teamidCS_TEAM_CT );
                case 
CS_TEAM_CTcs_set_user_teamidCS_TEAM_T );
            }
        }
    }


1.The plugin works but my problem is another one:


I have furien_wallhang from furien mod. I tried to edit in order to give free wallhang to every furien (TERO) at the beginning of the round.
I managed to accomplish that but I have a problem with the switch teams plugin.

My code looks like this:
PHP Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

#include "furien.inc"
#include "furien_shop.inc"

#define VERSION "0.0.2"

#define XTRA_OFS_PLAYER            5
#define m_Activity                73
#define m_IdealActivity            74
#define m_flNextAttack            83
#define m_afButtonPressed        246

#define FIRST_PLAYER_ID    1
#define MAX_PLAYERS        32

#define PLAYER_JUMP        6

#define ACT_HOP 7

//#define FBitSet(%1,%2)        (%1 & %2)

new g_iMaxPlayers
#define IsPlayer(%1)    ( FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers )

#define IsHidden(%1)    IsPlayer(%1)

#define KNIFE_DRAW            3

new g_bHasWallHang
#define SetUserWallHang(%1)        g_bHasWallHang |=    1<<(%1&31)
#define RemoveUserWallHang(%1)    g_bHasWallHang &=    ~(1<<(%1&31))
#define HasUserWallHang(%1)        g_bHasWallHang &    1<<(%1&31)

new g_bHanged
#define SetUserHanged(%1)    g_bHanged |=    1<<(%1&31)
#define RemoveUserHanged(%1)    g_bHanged &=    ~(1<<(%1&31))
#define IsUserHanged(%1)        g_bHanged &    1<<(%1&31)

new Float:g_fVecMins[MAX_PLAYERS+1][3]
new 
Float:g_fVecMaxs[MAX_PLAYERS+1][3]
new 
Float:g_fVecOrigin[MAX_PLAYERS+1][3]


new 
bool:g_bRoundEnd

public plugin_init()
{
    
register_plugin("Furien WallHang"VERSION"ConnorMcLeod")


    
RegisterHam(Ham_Player_Jump"player""Player_Jump")
    
RegisterHam(Ham_Touch"func_wall""World_Touch")
    
RegisterHam(Ham_Touch"func_breakable""World_Touch")
    
RegisterHam(Ham_Touch"worldspawn""World_Touch")

    
g_iMaxPlayers get_maxplayers()    

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
}

public 
Event_HLTV_New_Round()
{
    
g_bRoundEnd false
}

public 
Logevent_Round_End()
{
    
g_bRoundEnd true
    g_bHanged 
0
}

public 
client_putinserverid )
{

    
SetUserWallHangid )

}


public 
furien_round_restart()
{
    
g_bHanged 0
}


public 
Player_Jump(id)
{
    if(    
g_bRoundEnd
    
||    ~HasUserWallHang(id)
    ||    ~
IsUserHanged(id)
    ||    !
is_user_alive(id)    )
    {
        return 
HAM_IGNORED
    
}

    if( (
pev(idpev_flags) & FL_WATERJUMP) || pev(idpev_waterlevel) >= )
    {
        return 
HAM_IGNORED
    
}

    static 
afButtonPressed afButtonPressed get_pdata_int(idm_afButtonPressed)

    if( ~
afButtonPressed IN_JUMP )
    {
        return 
HAM_IGNORED
    
}

    
RemoveUserHanged(id)

    new 
Float:fVecVelocity[3]

    
velocity_by_aim(id600fVecVelocity)
    
set_pev(idpev_velocityfVecVelocity)

    
set_pdata_int(idm_ActivityACT_HOP)
    
set_pdata_int(idm_IdealActivityACT_HOP)
    
set_pev(idpev_gaitsequencePLAYER_JUMP)
    
set_pev(idpev_frame0.0)
    
set_pdata_int(idm_afButtonPressedafButtonPressed & ~IN_JUMP)

    return 
HAM_SUPERCEDE
}


public 
client_PostThink(id)
{
    if( 
HasUserWallHang(id) && IsUserHanged(id) )
    {
        
engfunc(EngFunc_SetSizeidg_fVecMinsid ], g_fVecMaxsid ])
        
engfunc(EngFunc_SetOriginidg_fVecOriginid ])
        
set_pev(idpev_velocity0)
        
set_pdata_float(idm_flNextAttack1.0XTRA_OFS_PLAYER)
    }
}

public 
World_Touch(iEntid)
{
    if(    !
g_bRoundEnd
    
&&    IsPlayer(id)
    &&    
HasUserWallHang(id)
    &&    ~
IsUserHanged(id)
    &&    
is_user_alive(id)
    &&    
pev(idpev_button) & IN_USE
    
&&    ~pev(idpev_flags) & FL_ONGROUND    )
    {
        
SetUserHanged(id)
        
pev(idpev_minsg_fVecMins[id])
        
pev(idpev_maxsg_fVecMaxs[id])
        
pev(idpev_origing_fVecOrigin[id])
    }



The initial plugin had those lines:
PHP Code:

public furien_team_change/*iFurien */ )
{
    if( !
g_iCost[Furien] || !g_iCost[AntiFurien] )
    {
        
g_bHasWallHang 0
        g_bHanged 
0
    
}


But because I'm not using the auto switch teams from the furien mod (because it isen't working) I don't know how to write those two lines g_bHasWallHang = 0 / g_bHanged = 0.
If I don't write them when I'm hanged to a wall when the round ends and the teams change, they do change but I still remain hanged to the wall. Basically if ,for example, I am TERO and lose the round I die hanged to the wall and revive still hanged to the wall as a CT.

2. I am also having a very big trouble with the bomb on furien mod, I don't know why but when the bomb explodes it kills everybody furiens and anti-furiens. I haven't change anything in the original furien mod plugins. I installed it from scratch and still the same problem.

Sorry for my bad English and Thank you in advance.

arslan 02-26-2013 16:58

Re: Free wallhang + team switch
 
Try this plugin for SWITCH_TEAMS:

PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 

#define PLUGIN "furien_switch" 
#define VERSION "1.0" 
#define AUTHOR "Arslan" 


public plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR
     
    
register_event"SendAudio""CT_win""a""2&%!MRAD_ctwin" )  

public 
CT_win() 

    new 
iPlayers[32], pnumid 
    get_players
(iPlayerspnum
     
    for(new 
ipnumi++) 
    { 
        
id iPlayers[i
         
        if ( 
is_user_connectedid ) ) 
        { 
            switch( 
cs_get_user_teamid ) ) 
            { 
                case 
CS_TEAM_T
                { 
                    
cs_set_user_team(idCS_TEAM_CTCS_CT_GIGN
                } 
                case 
CS_TEAM_CT
                { 
                    
cs_set_user_team(idCS_TEAM_TCS_T_LEET
                } 
            } 
        } 
    } 


And the WallHang here is the plugin for your server...

ScarFaceGaming 02-03-2020 13:35

WallHang
 
Hello dear community I would like to create a Furien mod server which I have so far, only the pluggin is not working properly wallhang.amxx
I would like this to be free for both teams, and if I hang on a wall and the round starts again, I will stay right there, please help me, it would be really nice


PHP Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>


#define VERSION "0.0.2"

#define XTRA_OFS_PLAYER            5
#define m_Activity                73
#define m_IdealActivity            74
#define m_flNextAttack            83
#define m_afButtonPressed        246

#define FIRST_PLAYER_ID    1
#define MAX_PLAYERS        32

#define PLAYER_JUMP        6

#define ACT_HOP 7

//#define FBitSet(%1,%2)        (%1 & %2)

new g_iMaxPlayers
#define IsPlayer(%1)    ( FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers )

#define IsHidden(%1)    IsPlayer(%1)

#define KNIFE_DRAW            3

new g_bHasWallHang
#define SetUserWallHang(%1)        g_bHasWallHang |=    1<<(%1&31)
#define RemoveUserWallHang(%1)    g_bHasWallHang &=    ~(1<<(%1&31))
#define HasUserWallHang(%1)        g_bHasWallHang &    1<<(%1&31)

new g_bHanged
#define SetUserHanged(%1)    g_bHanged |=    1<<(%1&31)
#define RemoveUserHanged(%1)    g_bHanged &=    ~(1<<(%1&31))
#define IsUserHanged(%1)        g_bHanged &    1<<(%1&31)

new Float:g_fVecMins[MAX_PLAYERS+1][3]
new 
Float:g_fVecMaxs[MAX_PLAYERS+1][3]
new 
Float:g_fVecOrigin[MAX_PLAYERS+1][3]


new 
bool:g_bRoundEnd

public plugin_init()
{
    
register_plugin("Furien WallHang"VERSION"ConnorMcLeod")


    
RegisterHam(Ham_Player_Jump"player""Player_Jump")
    
RegisterHam(Ham_Touch"func_wall""World_Touch")
    
RegisterHam(Ham_Touch"func_breakable""World_Touch")
    
RegisterHam(Ham_Touch"worldspawn""World_Touch")

    
g_iMaxPlayers get_maxplayers()    

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
}

public 
Event_HLTV_New_Round()
{
    
g_bRoundEnd false
}

public 
Logevent_Round_End()
{
    
g_bRoundEnd true
    g_bHanged 
0
}

public 
client_putinserverid )
{

    
SetUserWallHangid )

}


public 
furien_round_restart()
{
    
g_bHanged 0
}


public 
Player_Jump(id)
{
    if(    
g_bRoundEnd
    
||    ~HasUserWallHang(id)
    ||    ~
IsUserHanged(id)
    ||    !
is_user_alive(id)    )
    {
        return 
HAM_IGNORED
    
}

    if( (
pev(idpev_flags) & FL_WATERJUMP) || pev(idpev_waterlevel) >= )
    {
        return 
HAM_IGNORED
    
}

    static 
afButtonPressed afButtonPressed get_pdata_int(idm_afButtonPressed)

    if( ~
afButtonPressed IN_JUMP )
    {
        return 
HAM_IGNORED
    
}

    
RemoveUserHanged(id)

    new 
Float:fVecVelocity[3]

    
velocity_by_aim(id600fVecVelocity)
    
set_pev(idpev_velocityfVecVelocity)

    
set_pdata_int(idm_ActivityACT_HOP)
    
set_pdata_int(idm_IdealActivityACT_HOP)
    
set_pev(idpev_gaitsequencePLAYER_JUMP)
    
set_pev(idpev_frame0.0)
    
set_pdata_int(idm_afButtonPressedafButtonPressed & ~IN_JUMP)

    return 
HAM_SUPERCEDE
}


public 
client_PostThink(id)
{
    if( 
HasUserWallHang(id) && IsUserHanged(id) )
    {
        
engfunc(EngFunc_SetSizeidg_fVecMinsid ], g_fVecMaxsid ])
        
engfunc(EngFunc_SetOriginidg_fVecOriginid ])
        
set_pev(idpev_velocity0)
        
set_pdata_float(idm_flNextAttack1.0XTRA_OFS_PLAYER)
    }
}

public 
World_Touch(iEntid)
{
    if(    !
g_bRoundEnd
    
&&    IsPlayer(id)
    &&    
HasUserWallHang(id)
    &&    ~
IsUserHanged(id)
    &&    
is_user_alive(id)
    &&    
pev(idpev_button) & IN_USE
    
&&    ~pev(idpev_flags) & FL_ONGROUND    )
    {
        
SetUserHanged(id)
        
pev(idpev_minsg_fVecMins[id])
        
pev(idpev_maxsg_fVecMaxs[id])
        
pev(idpev_origing_fVecOrigin[id])
    }


pls Help me:cry::cry:

OciXCrom 02-03-2020 17:02

Re: Free wallhang + team switch
 
And why did you think bumping a 7 year old thread is a good idea? If you have a problem, create a new thread.


All times are GMT -4. The time now is 08:18.

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