This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[ZombieMod] New round all to CT


Post New Thread Reply   
 
Thread Tools Display Modes
SoulWeaver16
Senior Member
Join Date: May 2021
Location: Uruguay
Old 07-18-2023 , 13:03   Re: [ZombieMod] New round all to CT
Reply With Quote #11

Here I have this code, but it doesn't work automatically when the round starts, only when I give the amx_ct command
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >


public plugin_init( ) {
    
register_plugin"All to CT""1.0""xPaw" );
    
    
register_concmd"amx_ct""CmdAllToCT"ADMIN_KICK );
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    }


public 
event_round_startid )
{
    
set_trans_teamid );
}

public 
set_trans_teamid )
{
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"e""TERRORIST" );
    
    for( new 
iiNumi++ )
    {
        
id iPlayers];
        
cs_set_user_teamidCS_TEAM_CT );
    }

    return 
PLUGIN_HANDLED;
}
public 
CmdAllToCTidiLeveliCid ) {
    if( !
cmd_accessidiLeveliCid) )
    return 
PLUGIN_HANDLED;
    
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"e""TERRORIST" );
    
    for( new 
iiNumi++ ) {
        
id iPlayers];
        
cs_set_user_teamidCS_TEAM_CT );
    }

    return 
PLUGIN_HANDLED;

__________________
Extended Arm Weapon Skin v2.1 {16/Apr/23}
(Detect which class is and associate it with the corresponding arms)
SideWeapons v0.2 {01/Sep/22}
(New version of Back Weapons v1.87)

SoulWeaver16 is offline
1xAero
Member
Join Date: Feb 2018
Location: Sakha, Russia
Old 07-18-2023 , 13:42   Re: [ZombieMod] New round all to CT
Reply With Quote #12

Register spawn forward. Null before true meaning it's not post, true at the end - automatic zbot registration (amx mod x 1.9 and above)

Code:
RegisterHam(Ham_Spawn, "player", "HamF_PlayerSpawn", 0, true);

//Move everyone to one team at spawn.
public HamF_PlayerSpawn(iPlayer)
{
         //Not a zombie respawned.
	 if(!zp_get_user_zombie(iPlayer))
		set_pdata_int(iPlayer, 114, 2, 5);	
}
Also, because maybe the team spawns will be limited to 16 - some players may die right after spawn.
You need to take care about that too.
What i've made - moving players to one team like that and checking for available spawn point. If it's busy, move player to nearby free coordinates.
You can take look how it's done here: https://forums.alliedmods.net/showthread.php?t=342732, UnstuckPlayer function at Spawn Post.

Last edited by 1xAero; 07-18-2023 at 13:52.
1xAero is offline
SoulWeaver16
Senior Member
Join Date: May 2021
Location: Uruguay
Old 07-18-2023 , 18:59   Re: [ZombieMod] New round all to CT
Reply With Quote #13

Quote:
Originally Posted by 1xAero View Post
Register spawn forward. Null before true meaning it's not post, true at the end - automatic zbot registration (amx mod x 1.9 and above)

Code:
RegisterHam(Ham_Spawn, "player", "HamF_PlayerSpawn", 0, true);

//Move everyone to one team at spawn.
public HamF_PlayerSpawn(iPlayer)
{
         //Not a zombie respawned.
	 if(!zp_get_user_zombie(iPlayer))
		set_pdata_int(iPlayer, 114, 2, 5);	
}
Also, because maybe the team spawns will be limited to 16 - some players may die right after spawn.
You need to take care about that too.
What i've made - moving players to one team like that and checking for available spawn point. If it's busy, move player to nearby free coordinates.
You can take look how it's done here: https://forums.alliedmods.net/showthread.php?t=342732, UnstuckPlayer function at Spawn Post.
Yes, but as a Zombie Mod game, the spawns are random, the only thing I was looking for is for them to change sides to stay in the CT team, like who opens the admin menu and silently changes the team
__________________
Extended Arm Weapon Skin v2.1 {16/Apr/23}
(Detect which class is and associate it with the corresponding arms)
SideWeapons v0.2 {01/Sep/22}
(New version of Back Weapons v1.87)

SoulWeaver16 is offline
Reply



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 18:00.


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