AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Switch Teams on T win? (https://forums.alliedmods.net/showthread.php?t=308117)

ImYourBro 06-07-2018 10:29

Switch Teams on T win?
 
Hello

Im searching for a plugin that swap teams on t win.

Thanks

CrazY. 06-07-2018 10:46

Re: Switch Teams on T win?
 
What you mean? Swap players team on every time a team win the round, or only in the first time?

instinctpt1 06-07-2018 12:39

Re: Switch Teams on T win?
 
PHP Code:

#include <amxmodx>
#include <cstrike>

new boolterrorWon

public plugin_init()
{
    
register_plugin("Swap on T Win""1.0""DiGiTaL")
    
register_event("SendAudio""TerrorWon""a""2=%!MRAD_terwin");
    
register_logevent"LogeventEndRound"2"1=Round_End" )
}

public 
TerrorWon() terrorWon true;

public 
LogeventEndRound()
{
    if(
terrorWon)
    {
        new 
players[32], iNum
        get_players
(playersiNum)
        for(new 
i=0iNumi++)
        {
            
players[i]
            switch(
cs_get_user_team(x))
            {
                case 
CS_TEAM_Tcs_set_user_team(xCS_TEAM_CT)
                case 
CS_TEAM_CTcs_set_user_team(xCS_TEAM_T)
            }
        }
        
terrorWon false;
    }



CrAzY MaN 06-07-2018 13:05

Re: Switch Teams on T win?
 
I m making a "Confusing Swapping Mod" xD
Will upload soon

Relaxing 06-07-2018 14:10

Re: Switch Teams on T win?
 
For crashless purposes, use cs_team_changer module which prevents crashes while all players try to swap teams. I've used it on my furien mod and it has never crashed or something.

CrazY. 06-07-2018 14:26

Re: Switch Teams on T win?
 
Or just update to AMx Mod X 1.8.3 to doesn't get crashs.

ImYourBro 06-07-2018 15:18

Re: Switch Teams on T win?
 
Quote:

Originally Posted by instinctpt1 (Post 2595701)
PHP Code:

#include <amxmodx>
#include <cstrike>

new boolterrorWon

public plugin_init()
{
    
register_plugin("Swap on T Win""1.0""DiGiTaL")
    
register_event("SendAudio""TerrorWon""a""2=%!MRAD_terwin");
    
register_logevent"LogeventEndRound"2"1=Round_End" )
}

public 
TerrorWon() terrorWon true;

public 
LogeventEndRound()
{
    if(
terrorWon)
    {
        new 
players[32], iNum
        get_players
(playersiNum)
        for(new 
i=0iNumi++)
        {
            
players[i]
            switch(
cs_get_user_team(x))
            {
                case 
CS_TEAM_Tcs_set_user_team(xCS_TEAM_CT)
                case 
CS_TEAM_CTcs_set_user_team(xCS_TEAM_T)
            }
        }
        
terrorWon false;
    }



Doesnt seem to work correctly. Shouldn't you turn around the cs_set_user_team?

ImYourBro 06-07-2018 15:22

Re: Switch Teams on T win?
 
Quote:

Originally Posted by CrazY. (Post 2595686)
What you mean? Swap players team on every time a team win the round, or only in the first time?

Every time Terrorist wins, teams should we swapped. When CT wins, nothing should happen

instinctpt1 06-08-2018 00:35

Re: Switch Teams on T win?
 
Quote:

Originally Posted by ImYourBro (Post 2595748)
Doesnt seem to work correctly. Shouldn't you turn around the cs_set_user_team?

What not working correctly.. elaborate pls
I tested this now on 183 and it's working correctly

iceeedr 06-08-2018 00:44

Re: Switch Teams on T win?
 
Quote:

Originally Posted by ImYourBro (Post 2595749)
Every time Terrorist wins, teams should we swapped. When CT wins, nothing should happen

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define isTeam(%0)         (CS_TEAM_T <= cs_get_user_team(%0) <= CS_TEAM_CT)

new bool:TWin
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("SendAudio""EventTRWin","a""2&%!MRAD_terwin")
    
register_event("HLTV","EventNewRnd""a""1=0""2=0")
    
register_logevent"LogeventEndRound"2"1=Round_End" 
}

public 
EventTRWin()
    
TWin true

public EventNewRnd()
    
TWin false
    
public LogeventEndRound()
{
    if(
TWin)
    {
        new 
iPlayers[MAX_PLAYERS], iNum
        get_players
(iPlayersiNum"ch")
        for(new 
iidiNum;i++)
        {
            
id iPlayers[i]
            
            if(
isTeam(id))
                
cs_set_user_team(id, (cs_get_user_team(id) == CS_TEAM_T) ? CS_TEAM_CT CS_TEAM_T)
        }
    }




All times are GMT -4. The time now is 04:42.

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