AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help on plugin "Team Change" (https://forums.alliedmods.net/showthread.php?t=89186)

F4RR3LL 04-03-2009 11:56

Help on plugin "Team Change"
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>

new PLUGIN[]="Team Change"
new AUTHOR[]="st0ka"
new VERSION[]="1.00"

public plugin_init()
{
      register_plugin(PLUGIN,VERSION,AUTHOR)     
      register_concmd("say /ct","team_ct")
      register_concmd("say_team /ct","team_ct")
      register_concmd("say /spec","team_spec")
      register_concmd("say_team /spec","team_spec")
      register_concmd("say /respawn","player_respawn")
      register_concmd("say_team /respawn","player_respawn")
      set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
}

public team_ct(id)
{
      new CsTeams:team = cs_get_user_team(id)
      if (team == CS_TEAM_CT)
      {
                return PLUGIN_HANDLED
      }
      else
      {
            cs_set_user_team(id,CS_TEAM_CT,CS_DONTCHANGE)
            cs_user_spawn(id)
            give_item(id,"weapon_knife")
            give_item(id,"weapon_usp")
            give_item(id,"weapon_usp")
            give_item(id,"weapon_usp")
      }
      return PLUGIN_HANDLED
}

public team_spec(id)
{
      new CsTeams:team = cs_get_user_team(id)
      if (team == CS_TEAM_SPECTATOR)
      {
                return PLUGIN_HANDLED
      }
      else
      {
            entity_set_int(id,EV_INT_deadflag,DEAD_DISCARDBODY)
            cs_set_user_team(id,CS_TEAM_SPECTATOR,CS_DONTCHANGE)
      }
      return PLUGIN_HANDLED
}

public player_respawn(id)
{
      new CsTeams:team = cs_get_user_team(id)
      if (team == CS_TEAM_SPECTATOR)
      {
                return PLUGIN_HANDLED
      }
      else if (!is_user_alive(id))
      {
            cs_user_spawn(id)
            give_item(id,"weapon_knife")
            give_item(id,"weapon_usp")
            give_item(id,"weapon_usp")
            give_item(id,"weapon_usp")
      }
      return PLUGIN_HANDLED
}

What do that function team_ct, team_spec was executed when striking the button "M"? Like looks simply, but beside me brain came short :D

thanks

F4RR3LL 04-03-2009 12:13

Re: Help on plugin "Team Change"
 
The Example:
Has Pressed "M", has carried in spec, has pressed once again "M", appeared again for CT.

Emp` 04-03-2009 12:56

Re: Help on plugin "Team Change"
 
Check http://forums.alliedmods.net/showthread.php?t=69819

xPaw 04-03-2009 13:09

Re: Help on plugin "Team Change"
 
PHP Code:

register_clcmd"chooseteam""cmdChangeTeam" );

public 
cmdChangeTeamid ) {
    if( 
get_user_team(id) == )
        
team_ctid );
    else if( 
get_user_team(id) == )
        
team_specid );
    
    return 
PLUGIN_HANDLED;



F4RR3LL 04-03-2009 13:39

Re: Help on plugin "Team Change"
 
thaanks :D


All times are GMT -4. The time now is 02:27.

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