View Single Post
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 11-02-2023 , 11:08   Re: Dead Switch Team Plugin
Reply With Quote #2

I found a others method for it but i would its automatic. I made on this when they are dead admin need to type bb_swap deadct on the console and it will switch. But if someone can do it automatic at last round instead of typing. (For the last round map) 6 of 6

PHP Code:
public cmdSwap(id)
{
    if (
access(idSWAP))
    {
        new 
arg[32];
        
read_argv(1arg31);

        if (
equal(arg"deadct"true))
        {
            new 
hasDeadCT false
            
            new 
player;
            for (
player 1player <= get_maxplayers(); player++)
            {
                if (
is_user_connected(player) && cs_get_user_team(player) == CS_TEAM_CT && !is_user_alive(player))
                {
                    
// Switch the dead CT player to the terrorist team
                    
cs_set_user_team(playerCS_TEAM_T);
                    
                    
// Respawn the player as a Zombie
                    
Respawn_Zombie(player);
                    
                    
hasDeadCT true;
                    
                    
client_print(playerprint_chat"[BaseBuilder] You have been moved to the Terrorist team for the last round.");
                }
            }
            
            if (!
hasDeadCT)
            {
                
// Print msg
                
client_print(idprint_console"[Swap] There are no dead players on CT!");
                return 
PLUGIN_HANDLED;
            }
            
            
// Log and print a message indicating the action
            
new adminname[35];
            
get_user_name(idadminname34);
            
Log("[TEAM-SWAP-DEADCT] Admin: %s switched dead CT players to Terrorist team and respawned them as Zombies"adminname);
            
client_print(idprint_console"[Swap] You switched all dead Builder players to Zombies.");
        }
        else
        {
            new 
player cmd_target(idargCMDTARGET_OBEY_IMMUNITY);
            
            if (!
is_user_connected(player)) return PLUGIN_HANDLED;
            
            
cs_set_user_team(playercs_get_user_team(player) == CS_TEAM_T CS_TEAM_CT CS_TEAM_T);
            
            if (
cs_get_user_team(player) == CS_TEAM_T)
            {
                
g_iszombie[player] = true;
                
g_ishuman[player] = false;
            }
            if (
cs_get_user_team(player) == CS_TEAM_CT)
            {
                
g_ishuman[player] = true;
                
g_iszombie[player] = false;
            }
            
            if (
is_user_alive(player))
                
ExecuteHamB(Ham_CS_RoundRespawnplayer);
            
            
// Print a message to the switched player
            
client_print(playerprint_chat"[BaseBuilder] You've been changed to the other team by an admin!");
            
            new 
adminname[35], playername[35];
            
get_user_name(idadminname34);
            
get_user_name(playerplayername34); 
            
Log("[TEAM-SWAP] Admin: %s swapped Player: %s"adminnameplayername);
            
            
client_print(idprint_console"[Swap] Player %s has been switched to the opposite team."playername);
        }
    }
    return 
PLUGIN_HANDLED;

__________________
CS:CZ > CS 1.6

Last edited by Ace67; 04-19-2024 at 17:46.
Ace67 is offline