AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to change player's team ? (https://forums.alliedmods.net/showthread.php?t=193645)

wwzw 08-21-2012 12:45

How to change player's team ?
 
I want to change the player's team, I use cs_set_user_team ().

But:
1: One round can only be change once. This can not be used in CSDM mode .
2: If the player enters the server but did not join the team. This change also make mistakes.
3: When a player chooses a team, but there is no choice models. This is also wrong.

Please help me! Or tell me a perfect plug-in, to achieve the functionality I want!
Thank you very much!

claudiuhks 08-21-2012 21:52

Re: How to change player's team ?
 
PHP Code:

#include < amxmodx >
#include < cstrike >
#include < fakemeta >

ChangeTeamiPlayeriTeamboolbKillboolbUpdateModel )
{
  if( 
pev_validiPlayer ) == // IsNullEnt( Player ) == false && Player -> PrivateData != NULL
  
{
    if( 
iTeam && iTeam )
    {
      !
bUpdateModel set_pdata_intiPlayer114iTeam ) : cs_set_user_teamiPlayeriTeam );

      if( 
bKill )
        
dllfuncDLLFunc_ClientKilliPlayer );
    }

    else if( 
iTeam == && is_user_aliveiPlayer ) && ( get_pdata_intiPlayer114 ) != && get_pdata_intiPlayer114 ) != ) ) // Transfer to spectator only if player is alive -- is more reliable.
    
{
      
set_pdata_intiPlayer114);

      
dllfuncDLLFunc_ClientKilliPlayer );
    }
  }



wwzw 08-22-2012 20:51

Re: How to change player's team ?
 
Thank you for your help!
I tested this code, but I did not want the results:
1: Monitor is team when a player enters the server First, change the player's team is not complete: the start will not get a knife and weapons, the time is displayed in the top of the screen.
2: When a player enters the server, but do not select the team. The result is not to change the players team.
3: When a player chooses a team, but there is no choice models. You can not change his team. . .


All times are GMT -4. The time now is 00:20.

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