AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Stuck at cs_set_user_team (https://forums.alliedmods.net/showthread.php?t=162892)

Diegorkable 07-24-2011 08:16

Stuck at cs_set_user_team
 
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?

bibu 07-24-2011 08:25

Re: Stuck at cs_set_user_team
 
Show your code.

Diegorkable 07-24-2011 08:32

Re: Stuck at cs_set_user_team
 
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

Honors 07-24-2011 08:51

Re: Stuck at cs_set_user_team
 
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.

Diegorkable 07-24-2011 08:55

Re: Stuck at cs_set_user_team
 
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 07-24-2011 09:01

Re: Stuck at cs_set_user_team
 
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?

Bugsy 07-24-2011 09:34

Re: Stuck at cs_set_user_team
 
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 );



Diegorkable 07-24-2011 09:39

Re: Stuck at cs_set_user_team
 
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

Bugsy 07-24-2011 10:11

Re: Stuck at cs_set_user_team
 
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); 


Diegorkable 07-24-2011 10:27

Re: Stuck at cs_set_user_team
 
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.


All times are GMT -4. The time now is 01:06.

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