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

anytime spec


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vase070
Senior Member
Join Date: Jun 2011
Old 01-09-2015 , 18:31   anytime spec
Reply With Quote #1

so i have a deathmatch server and i am admin and whenever i am playing and want to go spectator during game i cant because when i press change teams the spectator option witch is always "6" is not there so i have re enter the server and lose all my frags just so i can go to spec so is there a plugin that allows that option during game play i know that you can go spec when there is freezetime but on dm server there is no such thing
vase070 is offline
choloo
Senior Member
Join Date: Nov 2014
Location: Groznyj, Chechnya
Old 01-09-2015 , 23:25   Re: anytime spec
Reply With Quote #2

Type /spec to go spectator & /back to return (or choose team directly, m1 m2)
Cvars:
amx_specmode 0/1 ( 0 - all players | 1 - only admins) Default: 0
PHP Code:
/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "Spec Switch"
#define VERSION "0.1.3"
#define AUTHOR "many"

new CsTeams:zTeam[33]
new 
zDeath[33]
new 
bool:type_spec[33] = false
new g_cvar

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
/* Cvar */
    
g_cvar    register_cvar("amx_specmode",    "0")     // 0 - enable use to all, 1 - enable use only ADMINs
    /* Client Commands */
    
register_clcmd("say /spec",         "cmdSpec"ADMIN_ALL"- go to spectator")
    
register_clcmd("say_team /spec",     "cmdSpec"ADMIN_ALL"- go to spectator")
    
register_clcmd("say /back",         "cmdBack"ADMIN_ALL"- go back to your team")
    
register_clcmd("say_team /back",     "cmdBack"ADMIN_ALL"- go back to your team")
}

public 
cmdSpec(id)
{
    if(!
get_pcvar_num(g_cvar)) Spec(id)
    else if( 
get_pcvar_num(g_cvar) && (get_user_flags(id) & ADMIN_KICK)) Spec(id)
    else if( 
get_pcvar_num(g_cvar) && !(get_user_flags(id) & ADMIN_KICK)) PrintUserNotAdmin(id)
}

public 
cmdBack(id)
{
    if (
type_spec[id] && cs_get_user_team(id) == CS_TEAM_SPECTATOR && zTeam[id] != CS_TEAM_SPECTATOR Back(id)
    else if( 
get_pcvar_num(g_cvar) && !(get_user_flags(id) & ADMIN_KICK) ) PrintUserNotAdmin(id)
}

public 
Spec(id)
{
    
zDeath[id] = cs_get_user_deaths(id)
    if (
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
    return
    else{
        
type_spec[id] = true
        zTeam
[id] = cs_get_user_team(id)
        
cs_set_user_team(idCS_TEAM_SPECTATOR)
        
user_silentkill(id)
        
client_print(id,print_chat,"Type /back to return")
    }
    return
}

public 
Back(id)
{
    
cs_set_user_team(idzTeam[id])
    
cs_set_user_deaths(idzDeath[id])
    
set_task(0.5,"FirstRespawn",id)
    
set_task(0.8,"SecondRespawn",id)
}

public 
FirstRespawn(id)
{
    
cs_user_spawn(id)
}

public 
SecondRespawn(id)
{
    
cs_user_spawn(id)
    if (
cs_get_user_team(id) == CS_TEAM_T){
        
give_item(id,"weapon_knife")
        
give_item(id,"weapon_glock18")
        
give_item(id,"ammo_9mm")
    }
    if (
cs_get_user_team(id) == CS_TEAM_CT){
        
give_item(id,"weapon_knife")
        
give_item(id,"weapon_usp")
        
give_item(id,"ammo_45acp")
        
give_item(id,"ammo_45acp")
    }
}

PrintUserNotAdmin(id)
{
    
client_print(id,print_chat,"Only Admins can use /spec, /back command")
}

public 
PrintRule(id)
{
    if ( 
is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id) ){
        
client_print(id,print_chat,"")
        
client_print(id,print_chat,"")
    }
}

public 
client_putinserver(id)
{
    if(!
get_pcvar_num(g_cvar)) Rule(id)
    else if( 
get_pcvar_num(g_cvar) && (get_user_flags(id) & ADMIN_KICK)) Rule(id)
}

public 
client_disconnect(idtype_spec[id] = false
public client_connect(idtype_spec[id] = false
public Rule(idset_task(20.0"PrintRule"id)

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n{\\ colortbl ;\\ red0\\ green0\\ blue0;}\n\\ viewkind4\\ uc1\\ pard\\ cf1\\ lang1033\\ b\\ f0\\ fs16 \n\\ par }
*/ 
choloo 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 22:32.


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