Raised This Month: $159 Target: $400
 39% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Technical/Development        Approver:   Arkshine (91)
AlexALX
Senior Member
Join Date: Apr 2009
Old 08-27-2010 , 00:42   game_team_master & game_team_set fix (CS 1.6) v0.3 [UPDATE 15/09/10]
Reply With Quote #1

game_team_master & game_team_set fix (CS 1.6) v0.3
Description:
This plugin fix game_team_master and game_team_set entities for CS 1.6.
Without this plugin, these entities are always activated, regardless of the team player.

Modules:
Сstrike
Fakemeta
Hamsandwich

How to use:
Quote:
For game_team_master specify team in team index:
-1 - anyone can activate
1 - only Terrorist can activate
2 - only CT can activate

For game_team_set is now possible to specify a team to change for game_team_master:
-1 - changes team to all
0 - changes team to activator team (default)
1 - changes team to Terrorist
2 - changes team to CT

For specify team you must disable SmartEdit in Valve Hammer Editor and add manualy this:
Key: team, Value: 2 (or other). (see image)

Attention! Do not fix error in Valve Hammer Editor (alt+p):
Entity (game_team_set) has unused keyvalues.

See test map, which shows an example of work. I hope everything is understood.
Copyright and thanks:
Quote:
Created by AlexALX (c) 2010 http://alex-php.net/
Created special for map deathrun_skills_edited
Big thank Arkshine (http://forums.alliedmods.net/member.php?u=7779)
For help in creating plugin.
Created special for map deathrun_skills_edited.

ChangeLog:
Quote:
[15.09.10 - v0.3]
* Completely changed the code (thanks Arkshine), the function now works as on HL SDK (except for the added new option "team" for the game_team_set entity).
[28.08.10 - v0.2]
* Updated test map.
* Now for specify team for game_team_set you need disable SmartEdit in Valve Hammer Editor and add manualy: Key: team, Value: 2 (or other).
* Now teamindex is work, do not need use Yaw.
* You want to change the field Yaw on teamindex (for game_team_master) or team (for game_team_set). Otherwise Entites stop working on the map.
[27.08.10 - v0.1]
* First release.
Attached Thumbnails
Click image for larger version

Name:	game_team_set.jpg
Views:	2791
Size:	15.8 KB
ID:	73440  
Attached Files
File Type: sma Get Plugin or Get Source (game_team_master&set_fix.sma - 1918 views - 4.3 KB)
File Type: zip game_team_master&set_fix_v0_3.zip (50.6 KB, 853 views)

Last edited by AlexALX; 09-15-2010 at 12:52.
AlexALX is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-27-2010 , 06:22   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #2

Quote:
Use Yaw or Roll field in Valve Hammer Editor for set team, not Team Index (do not work).
That's fail fix tbh
__________________
xPaw is offline
AlexALX
Senior Member
Join Date: Apr 2009
Old 08-27-2010 , 10:06   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #3

Quote:
Originally Posted by xPaw View Post
That's fail fix tbh
I do not understand what you said (I am bad speak English). If you are speak russian - please say to pm or here if this do not inappropriate...
AlexALX is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 08-27-2010 , 10:53   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #4

This plugin fails out teh asshole.
__________________

Home of the AMX SUPER
Discord
DruGzOG is offline
Send a message via AIM to DruGzOG
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-27-2010 , 10:54   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #5

You say teamindex doesn't work, how did you tested ? Looking at the CS code, the keyvalue "teamindex" is well implemented and its offset should be 34 or 35.
__________________
Arkshine is offline
AlexALX
Senior Member
Join Date: Apr 2009
Old 08-27-2010 , 11:25   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
You say teamindex doesn't work, how did you tested ? Looking at the CS code, the keyvalue "teamindex" is well implemented and its offset should be 34 or 35.
I've had I will give that team index does not work without fix (activates all in not depending on the team), I just do not know offset, right now, try to do differently, but no game_team_set this value initially, but without smartedit can of course manually add. Ok I'll try. Thanks for the tip. Wait new version...

ps someone can give a list Entites where used as a team set game_team_master? (as game_player_hurt) They also like in CS does not work.
AlexALX is offline
AlexALX
Senior Member
Join Date: Apr 2009
Old 08-27-2010 , 11:40   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #7

I testet get_pdata_cbase(ent, 34) - always return -1, regardless of what is really set in editor. 35 - error.

Quote:
Originally Posted by DruGzOG View Post
This plugin fails out teh asshole.
Not understand...

Last edited by AlexALX; 08-27-2010 at 11:45.
AlexALX is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-27-2010 , 13:04   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #8

After some checks, the code is the same as HL1, so like you can see in HLSDK :

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 );     } }
Code:
const char *CGameTeamMaster::TeamID( void ) {     if ( m_teamIndex < 0 )    // Currently set to "no team"         return "";     return g_pGameRules->GetIndexedTeamName( m_teamIndex );  // UNDONE: Fill this in with the team from the "teamlist" }
Code:
BOOL CGameTeamMaster::TeamMatch( CBaseEntity *pActivator ) {     if ( m_teamIndex < 0 && AnyTeam() )         return TRUE;     if ( !pActivator )         return FALSE;     return UTIL_TeamsMatch( pActivator->TeamID(), TeamID() ); }

The problem is in UTIL_TeamsMatch(), because CBaseEntity::TeamID() and CGameTeamMaster::TeamID() return "" in CS. So yes, you can put any teamindex value, it will return always "", thus the check UTIL_TeamsMatch() always true.

As solution, you can hook CGameTeamMaster::TeamMatch() with Orpheu and redo the function and checking manually with the offset 35 (m_teamIndex) and cs_get_user_team for activor.

EDIT : I was writting the signature of the function when i've seen that in the windows decompiled code, the function is integrated as inline into CGameTeamMaster::Use(). Meaning, for windows It would need to redo the Use() function... :/ Will do it later, anyway.
__________________

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

What should I do? oO
AlexALX is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-27-2010 , 13:32   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #10

You can try to do like I've said, after all it's your plugin. But the current solution is not appropriate because the issue is not the teamindex keyvalue, and you should anyway use a proper version which doesn't require a specific change to get working the entity.
__________________
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 15:35.


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