Raised This Month: $32 Target: $400
 8% 

game_team_master & game_team_set fix (CS 1.6) v0.3 [UPDATE 15/09/10]


Post New Thread Reply   
 
Thread Tools Display Modes
AlexALX
Senior Member
Join Date: Apr 2009
Old 08-27-2010 , 18:38   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #21

Released v0.2... Test this...

Arkshine - very thanks you.
AlexALX is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-27-2010 , 18:47   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #22

A major problem with your plugin is it doesn't care about the others things. The purpose is to provide a fix, it means your plugin must have all the functionalities of entities. The code should be the same as the HLSDK with what you add.
__________________
Arkshine is offline
AlexALX
Senior Member
Join Date: Apr 2009
Old 08-27-2010 , 19:09   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #23

Quote:
Originally Posted by Arkshine View Post
A major problem with your plugin is it doesn't care about the others things. The purpose is to provide a fix, it means your plugin must have all the functionalities of entities. The code should be the same as the HLSDK with what you add.
Code:
void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
    if ( !CanFireForActivator( pActivator ) )
        return;

    if ( useType == USE_SET )
    {
        if ( value < 0 )
        {
            m_teamIndex = -1;
        }
        else
        {
            m_teamIndex = g_pGameRules->GetTeamIndex( pActivator->TeamID() );
        }
        return;
    }

    if ( TeamMatch( pActivator ) )
    {
        SUB_UseTargets( pActivator, triggerType, value );
        if ( RemoveOnFire() )
            UTIL_Remove( this );
    }
}
How this? What is:
Code:
if ( !CanFireForActivator( pActivator ) )
        return;
And this
Code:
if ( TeamMatch( pActivator ) )
    {
        SUB_UseTargets( pActivator, triggerType, value );
        if ( RemoveOnFire() )
            UTIL_Remove( this );
    }
This is flag "remove on fire" but did not understand the previous condition (if ( TeamMatch( pActivator)))
Code:
if ( RemoveOnFire() )
            UTIL_Remove( this );
And what about game_team_set...
AlexALX is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-27-2010 , 19:51   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #24

Something like that :

PHP Code:
    #include <amxmodx>
    #include <hamsandwich>
    #include <fakemeta>
    #include <cstrike>

    
enum USE_TYPE USE_OFF 0USE_ON 1USE_SET 2USE_TOGGLE };

    const 
m_iszMaster 34;
    const 
m_teamIndex 35;
    const 
triggerType 36;
    
    
#define RemoveOnFire(%0)     ( pev( %0, pev_spawnflags ) & SF_TEAMMASTER_FIREONCE )
    #define ShouldClearTeam(%0)  ( pev( %0, pev_spawnflags ) & SF_TEAMSET_CLEARTEAM   )
    #define AnyTeam(%0)          ( pev( %0, pev_spawnflags ) & SF_TEAMMASTER_ANYTEAM  )
    
    
public plugin_init()
    {
        
register_plugin"""""" );

        
RegisterHamHam_Use"game_team_master""CGameTeamMaster_Use" );
        
RegisterHamHam_Use"game_team_set"   "CGameTeamSet_Use"    );
    }

    public 
CGameTeamMaster_Use( const gameTeamMaster, const activator, const caller, const USE_TYPE:useType, const Float:value )
    {
        if ( !
CanFireForActivatorgameTeamMasteractivator ) )
        {
            return 
HAM_IGNORED;
        }

        if ( 
CGameTeamMaster_TeamMatchgameTeamMasteractivator ) )
        {
            
SUB_UseTargetsgameTeamMasteractivatorUSE_TYPE:get_pdata_inttriggerType), value );
            
            if ( 
RemoveOnFiregameTeamMaster ) )
            {
                
UTIL_RemovegameTeamMaster );
            }
        }
        
        return 
HAM_SUPERCEDE;
    }

    public 
CGameTeamSet_Use( const gameTeamSet, const activator, const caller, const USE_TYPE:useType, const Float:value )
    {
        if ( !
CanFireForActivatorgameTeamSetactivator ) )
        {
            return 
HAM_IGNORED;
        }
        
        new 
team pevgameTeamSetpev_team );
        
        new 
target32 ];
        
pevgameTeamSetpev_targettargetcharsmaxtarget ) );
            
        new 
master engfuncEngFunc_FindEntityByStringFM_NULLENT"targetname"target );
        new 
value team;
        
        if ( 
team || ShouldClearTeamgameTeamSet ) )
        {
            
value = -1;
        }
        else if ( !
team )
        {
            
value _:cs_get_user_teamactivator );
        }
        
        
set_pdata_intmasterm_teamIndexvalue );
        
        if ( 
RemoveOnFiregameTeamSet ) )
        {
            
UTIL_RemovegameTeamSet );
        }
        
        return 
HAM_SUPERCEDE;
    }

    
bool:CGameTeamMaster_TeamMatch( const entity, const activator )
    {
        new 
teamIndex get_pdata_intentitym_teamIndex);
        
        if ( 
teamIndex || AnyTeamentity ) )
        {
            return 
true;
        }

        if ( !
activator )
        {
            return 
false;
        }

        return 
cs_get_user_teamactivator ) == CsTeams:teamIndex;
    }
    
    
bool:CanFireForActivator( const entity, const activator )
    {
        new 
master get_pdata_intentitym_iszMaster);

        if ( 
master )
        {
            return 
UTIL_IsMasterTriggeredmasteractivator )
        }

        return 
true;
    }
    
    
bool:UTIL_IsMasterTriggered( const master, const activator )
    {
        if ( 
master )
        {
            new 
stringMaster32 ];
            
engfuncEngFunc_SzFromIndexstringMastercharsmaxstringMaster ) );

            new 
target engfuncEngFunc_FindEntityByStringFM_NULLENT"targetname"stringMaster );

            if ( 
target && ( ExecuteHamHam_ObjectCapstarget ) & FCAP_MASTER ) )
            {
                return 
CGameTeamMaster_TeamMatchtargetactivator );
            }
        }

        return 
true;
    }
    
    
SUB_UseTargets( const entity, const activatorUSE_TYPE:useTypeFloat:value )
    {
        new 
target32 ];
        
peventitypev_targettargetcharsmaxtarget ) );
    
        if ( 
target] )
        {
            
FireTargetstargetactivatorentityuseTypevalue );
        }
    }
    
    
FireTargets( const targetName[], const activator, const callerUSE_TYPE:useTypeFloat:value )
    {
        if ( !
targetName] )
        {
            return;
        }

        new 
target FM_NULLENT;
        
        while ( ( 
target engfuncEngFunc_FindEntityByStringtarget"targetname"targetName ) ) )
        {
            if ( 
target && ~pevtargetpev_flags ) & FL_KILLME )
            {
                
ExecuteHamHam_UsetargetactivatorcalleruseTypevalue );
            }
        }
    }
    
    
UTIL_Remove( const entity )
    {
        if ( 
entity )
        {   
            
set_peventitypev_flagspeventitypev_flags ) | FL_KILLME );
            
set_peventitypev_targetname);
        }
    } 
Not much tested, but it should work like your "how yo use". This version can keep the original behavior, master and spawnflags supported, etc.. So, the complete version. Also, since we replace the original Use() functions, we must supercede all the times.

With orpheu, we could call directly the functions, maybe I will do it another day.
__________________

Last edited by Arkshine; 08-27-2010 at 19:54.
Arkshine is offline
AlexALX
Senior Member
Join Date: Apr 2009
Old 08-27-2010 , 21:08   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #25

Arkshine - very thanks. I tested it tomorrow and try to do with his idea about game_team_set. In orpheu you need intercept function

Quote:
int CGameRules::GetTeamIndex()
{
return -1;
}
This in cs 1.6... So you need to replace it for normal) (info from Developers)
AlexALX is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-28-2010 , 04:41   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #26

I know it returns -1, why are you talking about that, we don't need this function anyway.
__________________

Last edited by Arkshine; 08-28-2010 at 04:44.
Arkshine is offline
AlexALX
Senior Member
Join Date: Apr 2009
Old 09-15-2010 , 07:55   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #27

Arkshine - i now tested you code and it do not work (always not activate). something wrong ... right now, try to understand.
AlexALX is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-15-2010 , 08:10   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #28

When i've said "Not much tested" ; I have still tested enough to post. Otherwise I would not have post a not-working plugin. So far I remember I've tested on both team, all etc.. with a game_player_equip entity and it was working perfectly for all cases.
__________________
Arkshine is offline
AlexALX
Senior Member
Join Date: Apr 2009
Old 09-15-2010 , 09:57   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #29

Quote:
Originally Posted by Arkshine View Post
When i've said "Not much tested" ; I have still tested enough to post. Otherwise I would not have post a not-working plugin. So far I remember I've tested on both team, all etc.. with a game_player_equip entity and it was working perfectly for all cases.
Are you sure? And I say that your code wrong. And the mistake here:

Code:
SUB_UseTargets( gameTeamMaster, activator, USE_TYPE:get_pdata_int( triggerType, 4 ), value );
Must be:
Code:
SUB_UseTargets( gameTeamMaster, activator, USE_TYPE:get_pdata_int( gameTeamMaster, triggerType, 4 ), value );


And so - thank you very much. Still, you are mistaken in this...

And

Code:
    if ( !CanFireForActivator( gameTeamSet, activator ) )
    {
        return HAM_IGNORED;
    }
May be must be:

Code:
    if ( !CanFireForActivator( gameTeamSet, activator ) )
    {
        return HAM_SUPERCEDE;
    }
??? Or not?..

Last edited by AlexALX; 09-15-2010 at 10:00.
AlexALX is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-15-2010 , 10:13   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #30

Yes I've tested it faslty like i've said, but you're talking about about a thing there is some time ago and I don't remember well. Maybe I've tested only game_team_set but I remember well i've spent many time on it and I've posted only when it was working fine. Maybe I've done some modifications when I've cleanup the code, because since I was using a game_player_equip entity I remember I could know if it was working or not if I get or not a gun. So, probably a typo when I wanted to release.

Anyway for the first you're right, obviously.

The second, you're wrong. We have changed nothing which need to be supercede, just a check.
__________________

Last edited by Arkshine; 09-15-2010 at 10:43.
Arkshine 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 21:58.


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