Raised This Month: $ Target: $400
 0% 

When someone kill someone switch their teams.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-23-2008 , 08:29   Re: When someone kill someone switch their teams.
Reply With Quote #5

CVar:
  • amx_spt < 1 | 0 > - If 1(default), players' teams will switch if a terrorist killed a ct.
Code:
#include <amxmodx> #include <cstrike> #define VERSION "1.0" new p_On; new bool:g_bSwitch[ 33 ]; public plugin_init() {     register_plugin( "Switch Players Teams", VERSION, "Dores" );         p_On = register_cvar( "amx_spt", "1" );     register_event( "DeathMsg", "ev_Death", "a" );     register_logevent( "logev_roundEnd", 2, "1=Round_End" ); } public ev_Death( iVic ) {     if( !get_pcvar_num( p_On ) )     {         return PLUGIN_CONTINUE;     }         static iAtt ; iAtt = get_user_attacker( iVic );         if( cs_get_user_team( iVic ) == CS_TEAM_CT && cs_get_user_team( iAtt ) == CS_TEAM_T )     {         g_bSwitch[ iVic ] = true;         g_bSwitch[ iAtt ] = true;     }         return PLUGIN_CONTINUE; } public client_disconnect( id ) {     g_bSwitch[ id ] = false; } public logev_roundEnd() {     if( !get_pcvar_num( p_On ) )     {         return PLUGIN_CONTINUE;     }         static iMaxPlayers;     if( !iMaxPlayers )     {         iMaxPlayers = get_maxplayers();     }         static i;     static CsTeams:team;     for( i = 1 ; i <= iMaxPlayers ; i++ )     {         if( !is_user_connected( i ) || !g_bSwitch[ i ] )             continue;                 team = cs_get_user_team( i );         if( team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED )         {             g_bSwitch[ i ] = false;             continue;         }                 cs_set_user_team( i, ( team % CS_TEAM_CT ) + CS_TEAM_T );         g_bSwitch[ i ] = false;     }         return PLUGIN_CONTINUE; }
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 12-23-2008 at 08:32.
Dores is offline
 



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 09:11.


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