Raised This Month: $ Target: $400
 0% 

Help (Should be simple)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-06-2010 , 19:11   Re: Help (Should be simple)
Reply With Quote #6

PHP Code:
new bool:gSwitchPlayer[32] = false

public plugin_init()
{
    
register_event"DeathMsg" "SwitchTeams" "a" )
      
}

public 
SwitchTeams()
{
    new 
iAttacker read_data)     
    new 
iVictim read_data)

    if( 
iVictim == iAttacker )
        return 
PLUGIN_HANDLED

    
if( cs_get_user_teamiVictim ) == CS_TEAM_T && !is_user_botiVictim ) )
    {
        
gShouldSwitch[iVictim] = true
        gShouldSwitch
[iAttacker] = true
    
}
    else if( 
cs_get_user_teamiVictim ) == CS_TEAM_CT && !is_user_botiVictim ) )
    {
        
iTimer 30.0
    
}
    return 
PLUGIN_HANDLED
}

public 
round_end(iTimer//Not sure, but I believe this is correct. Might not be though.
{
    new 
iPlayers[32], iNum
    get_players
iPlayersiNum )

    for( new 
iiNumi++ )
    {
        new 
id iPlayers[i]
        
        if( !
is_user_bot(id) && gShouldSwitch[id] == true )
        {
            if( 
cs_get_user_teamid ) == CS_TEAM_T )
            {
                
cs_set_user_teamid ) == CS_TEAM_CT
            
}
            else if( 
cs_get_user_teamid ) == CS_TEAM_CT )
            {
                
cs_set_user_teamid ) == CS_TEAM_T
            
}
        }
    }

That should do it. Maybe not the most effective way, but it should work.

Last edited by RedRobster; 06-06-2010 at 19:39.
RedRobster 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 05:26.


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