Raised This Month: $32 Target: $400
 8% 

Stuck at cs_set_user_team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-24-2011 , 08:16   Stuck at cs_set_user_team
Reply With Quote #1

Hey guys, I made a plugin that sets users when they log in the game at a team that has less members. setting them works just fine but the problem is that after they're set(they're dead), and when next round starts they stand at their place, holding a bomb (even if they're CT...), and can only jump and move their mouse, but not move at all or switch weapons. why is that?

Last edited by Diegorkable; 07-24-2011 at 08:20.
Diegorkable is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-24-2011 , 08:25   Re: Stuck at cs_set_user_team
Reply With Quote #2

Show your code.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-24-2011 , 08:32   Re: Stuck at cs_set_user_team
Reply With Quote #3

PHP Code:
public MoveFromSpec(id)
{
    new 
players[32], pnumtempid;  
    new 
tteamctteam
      
    get_players
(playerspnum"ch"); 
        
    for( new 
ii<pnumi++ )  
    {  
        
tempid players[i];  
        if (
cs_get_user_team(tempid) == CS_TEAM_T
        { 
            
tteam++
        }
        
        else if(
cs_get_user_team(tempid) == CS_TEAM_CT)
        {
            
ctteam++
        }
    } 
    
    if (
tteam ctteam)
    {
        
cs_set_user_team(idCS_TEAM_CT)
    }
    
    else if (
ctteam >= tteam)
    {
        
cs_set_user_team(idCS_TEAM_T)
    }

AT the last lines of the code it sets his team to the team that has less teammates. and he's being moved FROM spectator to the selected team
Diegorkable is offline
Honors
Member
Join Date: Jul 2011
Old 07-24-2011 , 08:51   Re: Stuck at cs_set_user_team
Reply With Quote #4

Code:
new players[ 32 ] , numT , numCt get_players( players , numT , "he" , "TERRORIST" ) get_players( players , numCt , "he" , "CT" ) if( numT > numCt ) {      cs_set_user_team( id , CS_TEAM_CT ) } else {      cs_set_user_team( id , CS_TEAM_T ) }

That should work.

Last edited by Honors; 07-24-2011 at 11:04.
Honors is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-24-2011 , 08:55   Re: Stuck at cs_set_user_team
Reply With Quote #5

Its just what I did just a shorter code, will it prevent the users that gets their team set from being stuck? thats the question.
Diegorkable is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-24-2011 , 09:01   Re: Stuck at cs_set_user_team
Reply With Quote #6

It didn't help, I'm still stuck, all what you did is post my code with a different algorythm, got an idea how to fix me being stuck when set in a team?
Diegorkable is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-24-2011 , 09:34   Re: Stuck at cs_set_user_team
Reply With Quote #7

Untested. There have been reports of get_players not returning data properly with particular combinations of flags. If you run into problems with this method then that may be the case. Let me know if you have problems.
PHP Code:
public MoveFromSpec(id)
{
    new 
players[32], tteamctteam;
      
    
get_players(playerstteam"che" "TERRORIST" ); 
    
get_players(playersctteam "che" "CT" );

    
cs_set_user_teamid , ( ctteam >= tteam ) ? CS_TEAM_T CS_TEAM_CT );

__________________
Bugsy is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-24-2011 , 09:39   Re: Stuck at cs_set_user_team
Reply With Quote #8

But I really don't get you, how is your code different from the code of Honors? My problem is not that my code doesnt work, but that player gets stuck after being transferred SUCCESSFULLY to the team it should move to
Diegorkable is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-24-2011 , 10:11   Re: Stuck at cs_set_user_team
Reply With Quote #9

Sorry about that, I didn't read enough into your problem.

Not sure about this, but try calling this after setting team.
PHP Code:
 ExecuteHam(Ham_CS_RoundRespawnid); 
__________________
Bugsy is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-24-2011 , 10:27   Re: Stuck at cs_set_user_team
Reply With Quote #10

It kind of fixed it, but still didn't.

I mean, It does let the player move now, but, you can't see the lower bar(with the HP, time, armor, ammo etc...), you don't have a weapon, you don't have a zoom, and you keep spawning at random places in the map, when your height is really really near to the ground. except that, you're alive, I want him to be dead, maybe you know about any function that kills a client? cuz 'kill' is not working at that specific moment in console.
Diegorkable is offline
Reply


Thread Tools
Display Modes

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 09:10.


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