View Single Post
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 09-05-2015 , 00:55   Re: /spec and /back plugin
Reply With Quote #2

here you go :
PHP Code:
#include <amxmodx>
#include <cstrike>

public plugin_init() {
    
register_clcmd("say /spec","spec_transfer");
    
register_clcmd("say_team /spec","spec_transfer");
    
register_clcmd("say /back","back_transfer");
    
register_clcmd("say_team /back","back_transfer");
}

public 
spec_transfer(id)
{
    if(
cs_get_user_team(id) != CS_TEAM_SPECTATOR)
    {
        
cs_set_user_team(id,CS_TEAM_SPECTATOR);
        
user_silentkill(id);
    }
    else
    {
        
client_print(id,print_chat,"You are already on spectator");
    }
}

public 
back_transfer(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
    {
        new 
randrandom_num(1,2)
        switch(
rand)
        {
            case 
1:{
            
cs_set_user_team(id,CS_TEAM_CT);
            }
            
            case 
2:{
            
cs_set_user_team(id,CS_TEAM_T);
            }
        }
    }
    else
    {
        
client_print(id,print_chat,"you are not in spectator");
    }

Attached Files
File Type: sma Get Plugin or Get Source (spec.sma - 1739 views - 837 Bytes)
indraraj striker is offline