Raised This Month: $ Target: $400
 0% 

Respawn player after teamchange


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 03-28-2011 , 16:16   Respawn player after teamchange
Reply With Quote #1

Hey, how to respawn player correctly after teamchange???

I'm useing cs_set_user_team(id, CS_TEAM_CT) to transfer player from spectators to CT then I use user_silentkill(id), but on the first spawn he doesn't see HUD's, can use only first gun also no crosshair and he can't switch guns ;Dp x(
reinert is offline
Elusive138
Senior Member
Join Date: Dec 2010
Old 03-29-2011 , 04:53   Re: Respawn player after teamchange
Reply With Quote #2

Quote:
Originally Posted by reinert View Post
Hey, how to respawn player correctly after teamchange???

I'm useing cs_set_user_team(id, CS_TEAM_CT) to transfer player from spectators to CT then I use user_silentkill(id), but on the first spawn he doesn't see HUD's, can use only first gun also no crosshair and he can't switch guns ;Dp x(
I personally prefer to use hamsandwich, though there are other ways (search)

PHP Code:
#include <hamsandwich> 
PHP Code:
ExecuteHamB(Ham_CS_RoundRespawnid); 
Elusive138 is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 03-29-2011 , 05:11   Re: Respawn player after teamchange
Reply With Quote #3

Yes, but I'm not spawning user manually. It's like his first round spawn on other round... When I transfer him from Spec to CT I don't want to spawn him instantly. Player should wait for next round and only then get spawned, but when he gets spawned he doesn't see HUD's etc.

I've a teamchange menu... Like jointeam or chooseteam...

For example when player types /menu

He gets menu like:

Go To T
Go To CT
Go To Spec

and if player is transfered from spec to CT or T it gets bugged...

Last edited by reinert; 03-29-2011 at 05:14.
reinert is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-29-2011 , 07:08   Re: Respawn player after teamchange
Reply With Quote #4

The menu blocking method isn't exactly mine - I learnt it a while ago from read through another plugin.
So try this:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>

public plugin_init() 
{
    
register_plugin"Spec Join""0.1""hornet" );
    
    
register_clcmd"say /join""cmdJoin" );
    
    
register_messageget_user_msgid"ShowMenu" ), "msgMenu" );
    
register_messageget_user_msgid"VGUIMenu" ), "msgMenu" );
}

public 
msgMenumsgdestid )
{    
    if( 
cs_get_user_teamid ) == CS_TEAM_SPECTATOR )
    {
        static 
block;
        
block get_msg_blockmsg );
        
set_msg_blockmsgblock );
        
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}
    
public 
cmdJoinid )
{
    if( 
cs_get_user_teamid ) != CS_TEAM_SPECTATOR )
    return 
PLUGIN_HANDLED;
    
    new 
menustr64 ];
    
formatmenustrcharsmaxmenustr ),"\yChoose a team");
    new 
menu menu_createmenustr"menuTeam" );
    
    
menu_additemmenu"Terrorist""0");
    
menu_additemmenu"Counter-Terrorist""1");
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}

public 
menuTeamidmenuitem )
{
    new 
data], cb32 ];
    new 
accesscallback;    
    
menu_item_getinfomenuitemaccessdatacharsmaxdata ), cbcharsmaxcb ), callback );
    
    new 
team], key str_to_numdata );
    
    switch( 
key )
    {
        
//join T
        
case 0team "1";
        
//join CT
        
case 1team "2";
    }
    
    
joinTeamidteam );
}

joinTeamidteam[] )
{
    
engclient_cmdid"jointeam"team );
    
engclient_cmdid"joinclass""1" );


Last edited by hornet; 03-29-2011 at 07:35.
hornet is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 03-30-2011 , 12:34   Re: Respawn player after teamchange
Reply With Quote #5

It's not what I wanted to ask...

The problem is how can I transfer player from spectators, to Terrorists then spawn them in coming round without bugs...
reinert is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-30-2011 , 12:46   Re: Respawn player after teamchange
Reply With Quote #6

Well that's exactly what it does? If that's not quite what you want, atleast the functionality for it is in there. When you use the admin command to transfer players, it only changes their team. Players in spectator don't have the same things set up as a spawned player on T or CT does, which is why you can't simply transfer them. This plugin blocks the team change menu ( when you press m ) for spectators and forces a legitimate team change, which will result in the player spawning correctly the next round.
hornet is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 03-30-2011 , 14:16   Re: Respawn player after teamchange
Reply With Quote #7

But with this player can't change teams often, doesn't he ?
reinert is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-31-2011 , 01:48   Re: Respawn player after teamchange
Reply With Quote #8

I'm not exactly sure how to break the "only 1 team change per round" rule. I'll try figure it out, but hopefully someone else can help us out here?
hornet is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 03-31-2011 , 10:38   Re: Respawn player after teamchange
Reply With Quote #9

Quote:
Originally Posted by hornet View Post
I'm not exactly sure how to break the "only 1 team change per round" rule. I'll try figure it out, but hopefully someone else can help us out here?
http://forums.alliedmods.net/showpos...9&postcount=10
matsi is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 03-31-2011 , 12:36   Re: Respawn player after teamchange
Reply With Quote #10

Yeah thanks... Is it possible to show player teammenu with Spectator option while user is alive ?

Because only dead players can see spectator option.
reinert 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 14:30.


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