boss 1.17 bes island boss_mode21.amx running
Code:
/*
boss event amxx plugin © 2005 bes island
Uses team locking code © bardelot
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
In addition, as a special exception, the author gives permission to
link the code of this program with the Half-Life Game Engine ("HL
Engine") and Modified Game Libraries ("MODs") developed by Valve,
L.L.C ("Valve"). You must obey the GNU General Public License in all
respects for all of the code used other than the HL Engine and MODs
from Valve. If you modify this file, you may extend this exception
to your version of the file, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement from your
version.
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#pragma tabsize 0
static const BOSS_MODEL[] = "boss", // doar numele la model!! (locație - /models/player/NUME_MODEL/) NUME_MODEL = nume folder & model!
TIMER_2_BOSS = 10,
TASKID = 1997
//+humans_join_team..
new player, old_mp_autoteambalance, Float:old_mp_roundtime, Float:old_mp_buytime, old_mp_freezetime, old_mp_startmoney,Float:sv_grav,
bool:is_rr,timer
public plugin_init(){
register_plugin("boss","1.17","bes island")
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
register_event( "DeathMsg", "ev_DeathMsg", "a" )
register_event( "TextMsg", "BLOCK", "a", "2=#Game_Commencing", "2=#Game_will_restart_in" )
register_logevent("logevent_round_end", 2, "1=Round_End")
register_cvar("boss_speed","265.0")
register_cvar("boss_grav","450.0")
register_cvar("boss_hp","1000")
register_cvar("boss_ap","400")
}
public plugin_cfg(){
old_mp_autoteambalance=get_cvar_num("mp_autoteambalance")
old_mp_roundtime=get_cvar_float("mp_roundtime")
old_mp_buytime=get_cvar_float("mp_buytime")
old_mp_startmoney=get_cvar_num("mp_startmoney")
old_mp_freezetime=get_cvar_num("mp_freezetime")
sv_grav=get_cvar_float("sv_gravity")
}
public plugin_precache(){
new file[128];formatex(file,charsmax(file),"models/player/%s/%s.mdl",BOSS_MODEL,BOSS_MODEL)
precache_model(file)
replace(file,charsmax(file),".mdl","T.mdl")
if(file_exists(file)) precache_model(file)
}
public plugin_natives() register_native("boss_id_sts","check_id_boss")
public check_id_boss(iPlugins,iParams) return player //return 0 - adică nu a fost ales nimeni!
public BLOCK() is_rr=true
public event_new_round(){
is_rr=false
timer=TIMER_2_BOSS
if(!player){
new players[32], iPnum;get_players(players, iPnum, "ceh")
if(!iPnum) return
get_players(players, iPnum, "aceh","CT")
if(!iPnum) return
get_players(players, iPnum, "aceh","TERRORIST")
if(!iPnum) return
player=players[random(iPnum)]
MakeBoss()
}
else UnmakeBoss()
}
public ev_deathMsg() if(read_data(2)==player) UnmakeBoss()
public logevent_round_end() if(!is_rr) UnmakeBoss()
public MakeBoss(){
if(!is_user_alive(player)){
reverse_boss(0,true)
return
}
set_cvar_num("mp_autoteambalance",0)
set_cvar_float("mp_roundtime",9.0)
set_cvar_num("mp_startmoney",16000)
set_cvar_float("mp_buytime",0.2)
set_cvar_num("mp_freezetime",12)
set_cvar_num("sv_restart",1)
static players[32], num, i;get_players(players,num,"ch")
for(i=0;i<num;i++){
if(players[i]!=player&&get_user_team(players[i])==1){
cs_set_user_team(players[i],CS_TEAM_CT)
ExecuteHamB(Ham_CS_RoundRespawn,players[i])
}
}
set_task(1.0, "Countdown", TASKID, _, _, "a", timer)
}
public Countdown(){
if (timer <= 1) {
set_hudmessage(0, 255, 0, -1.0, 0.40, 0, 1.0, 1.0, 0.1, 1.0, 2)
show_hudmessage(0, "Time is up!")
remove_task(TASKID)
evolve_boss()
return
}
set_hudmessage(0, 255, 0, -1.0, 0.30, 0, 1.0, 1.0, 0.1, 1.0, 1)
show_hudmessage(0, "%s%d Second%s until The Chosen will come", timer<9?"0":"", timer--,timer==1?"":"s")
}
public evolve_boss(){
cs_set_user_team(player,CS_TEAM_T,CS_T_GUERILLA)
set_user_health(player,get_cvar_num("boss_hp"))
set_user_armor(player,get_cvar_num("boss_ap"))
if(user_has_weapon(player,CSW_C4)) engclient_cmd(player, "drop", "weapon_c4")
strip_user_weapons(player)
give_item(player,"weapon_knife")
give_item(player,"weapon_m249")
cs_set_user_bpammo(player,CSW_M249,200)
new pname[33];get_user_name(player,pname,charsmax(pname))
set_hudmessage(255,0,0)
show_hudmessage(0,"The %s is strong!",pname)
cs_reset_user_model(player)
cs_set_user_model(player,BOSS_MODEL)
set_user_maxspeed(player,get_cvar_float("boss_speed"))
set_user_gravity(player,get_cvar_float("boss_grav")/sv_grav)
}
public client_PreThink(id){
if(is_user_alive(id)&&player&&id==player){
set_user_maxspeed(id,get_cvar_float("boss_speed"))
set_user_gravity(id,get_cvar_float("boss_grav")/sv_grav)
}
}
public UnmakeBoss(){
if(player==0)return
player=0
reverse_boss()
}
stock reverse_boss(cvars=1,bool:rr=false){
clamp(cvars,0,1)
player=0
if(cvars){
set_cvar_float("mp_roundtime",old_mp_roundtime)
set_cvar_float("mp_buytime",old_mp_buytime)
set_cvar_num("mp_autoteambalance",old_mp_autoteambalance)
set_cvar_num("mp_freezetime",old_mp_freezetime)
set_cvar_num("mp_startmoney",old_mp_startmoney)
}
if(rr){
set_cvar_num("sv_restart",1)
set_task(5.0,"s_rr")
}
}
public s_rr() server_cmd("sv_restart 3")