Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSHelp for Biohazard 1.95 Version


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Hello, i have a problem with biohazard.sma , i dont know how to script.I will be glad if some help me.
I see myself in the table, through "Tab" - I the zombie, but actually I am survivor.
The radar shows only me and the zombie.
Other players see themselves the zombie, and actually they survivors.

Here i kill a zombie,
https://prikachi.net/images/IZTEGLEN...0b1840735d.jpg

And here im a survivor, but in T side ..

https://prikachi.net/images/IZTEGLEN...782e5eef7b.jpg


PHP Code:

/* Biohazard mod
*   
*  by Cheap_Suit
*
*  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
*/    

/*Version 1.95
* - Removed roundstart sound.
* - Removed spawn backpack removal.
* - Removed unnecessary codes.
* - Changed armor detection.
*/

#define VERSION    "1.95"

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <xs>
#tryinclude "biohazard.cfg"

#if AMXX_VERSION_NUM < 180
    #assert AMX Mod X v1.8.0 or greater library required!
#elseif !defined _biohazardcfg_included
    #assert Biohazard configuration file required!
#endif

#define OFFSET_DEATH         444
#define OFFSET_TEAM         114
#define OFFSET_ARMOR         112
#define OFFSET_NVG         129
#define OFFSET_PRIMARYWEAPON     116
#define OFFSET_CLIPAMMO     51
#define OFFSET_CLIPAMMO_LINUX     4

#define OFFSET_AMMO_AWP     377
#define OFFSET_AMMO_SCOUT     378
#define OFFSET_AMMO_M249     379
#define OFFSET_AMMO_FAMAS     380
#define OFFSET_AMMO_M3         381
#define OFFSET_AMMO_USP     382
#define OFFSET_AMMO_FIVESEVEN     383
#define OFFSET_AMMO_DEAGLE     384
#define OFFSET_AMMO_P228     385
#define OFFSET_AMMO_GLOCK18     386

#define AMMOID_FLASHBANG     11
#define AMMOID_HEGRENADE     12
#define AMMOID_SGGRENADE     13
#define AMMOID_C4        14

#define TASKID_STRIPNGIVE    698
#define TASKID_STARTROUND     153
#define TASKID_NEWROUND        641
#define TASKID_BALANCETEAM     375
#define TASKID_UPDATESCR    264
#define TASKID_SETZOMBIE    635
#define TASKID_SPAWNDELAY    786
#define TASKID_GIVENADES    922

#define EQUIP_PRI        (1<<0)
#define EQUIP_SEC        (1<<1)
#define EQUIP_GREN        (1<<2)
#define EQUIP_ALL        (1<<0 | 1<<1 | 1<<2)

#define HAS_NVG         (1<<0)
#define ATTRIB_BOMB         (1<<1)
#define DMG_HEGRENADE         (1<<24)
#define AMMOID_NULL         (1<<0 | 1<<AMMOID_FLASHBANG | 1<<AMMOID_HEGRENADE | 1<<AMMOID_SGGRENADE | 1<<AMMOID_C4)
#define AMMOWP_NULL         (1<<0 | 1<<CSW_KNIFE | 1<<CSW_FLASHBANG | 1<<CSW_HEGRENADE | 1<<CSW_SMOKEGRENADE | 1<<CSW_C4)

#define MAX_SPAWNS        128
#define MAX_AMMO        200
#define IMPULSE_FLASHLIGHT    100
#define MODEL_CLASSNAME        "player_model"

#define reset_user_primary(%1)   set_pdata_int(%1, OFFSET_PRIMARYWEAPON, 0)
#define set_weapon_ammo(%1,%2)   set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_CLIPAMMO_LINUX)
#define set_user_deaths(%1,%2)   set_pdata_int(%1, OFFSET_DEATH, %2)
#define is_player_alive(%1)      ((1 <= %1 <= g_maxplayers) && is_user_alive(%1))
#define _random(%1)          random_num(0, %1 - 1)

new cvar_regen_dly1cvar_regen_dly2cvar_randomspawncvar_zombie_spdcvar_skynamecvar_autobalance[2], cvar_starttime
    
cvar_lightscvar_zombie_defcvar_zombie_hpcvar_blocknightvisioncvar_killbonuscvar_gamedescriptioncvar_enabled
    
cvar_autonvgcvar_maxzombiescvar_customsoundscvar_hpbonuscvar_knockback_hpcvar_flashbangcvar_weaponsmenu,
    
cvar_zombie_atkcvar_knockback_duckcvar_hedmg_multicvar_zombie_regencvar_zombie_resistcvar_buytimecvar_ammo,
    
cvar_zombie_instantcvar_winsoundscvar_botquota
    
new bool:g_brestorevelFloat:g_vecvel[3], bool:g_roundstartedg_maxplayersg_spawncountbool:g_infectingbool:g_gamestarted
    
Float:g_spawns[MAX_SPAWNS+1][9], g_zombieoftheroundg_fwd_spawnbool:g_usingknifemodelbool:g_usingplayermodelg_equipmenu
    
g_primmenug_secmenug_fwd_resultg_fwd_infectg_fwd_teamwing_fwd_gamestartg_fwd_infect2CsTeams:g_winningteam,
    
bool:g_czerog_netclient_pdatag_botclient_pdatag_buyzoneFloat:g_buytime

new bool:g_zombie[33], Float:g_regendelay[33], g_victim[33], bool:g_showmenu[33], g_weapons[33][2], bool:g_falling[33], g_lastteam[33],
    
g_modelent[33], g_weaponent[33]

public 
plugin_precache()
{
    
register_plugin("Biohazard"VERSION"cheap_suit")
    
register_cvar("bh_version"VERSIONFCVAR_SPONLY|FCVAR_SERVER)
    
set_cvar_string("bh_version"VERSION)
    
    
cvar_enabled register_cvar("bh_enabled""1")
    if(!
get_pcvar_num(cvar_enabled)) return
    
    
g_usingplayermodel = (strlen(g_zombie_model) > 0) ? true false
    g_usingknifemodel  
= (strlen(g_zombie_claws) > 0) ? true false
    
if(g_usingplayermodelprecache_model(g_zombie_model)
    if(
g_usingknifemodel)  precache_model(g_zombie_claws)
    
    new 
i
    
for(0sizeof g_zombie_miss_soundsi++) precache_sound(g_zombie_miss_sounds[i])
    for(
0sizeof g_zombie_hit_sounds;  i++) precache_sound(g_zombie_hit_sounds[i])
    for(
0sizeof g_scream_sounds;        i++) precache_sound(g_scream_sounds[i])
    for(
0sizeof g_zombie_die_sounds;  i++) precache_sound(g_zombie_die_sounds[i])
    for(
0sizeof g_zombie_win_sounds;  i++) precache_sound(g_zombie_win_sounds[i])
    
    
g_fwd_spawn register_forward(FM_Spawn"fwd_spawn")
    new 
zone engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_bomb_target"))
    if(
zonedllfunc(DLLFunc_Spawnzone), set_pev(zonepev_solidSOLID_NOT)
    
    
g_buyzone engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_buyzone"))
    if(
g_buyzonedllfunc(DLLFunc_Spawng_buyzone), set_pev(g_buyzonepev_solidSOLID_NOT)
    
    
#if FOG_ENABLE
    
new fog engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_fog"))
    if(
fog)
    {
        new 
DENSITY[10]
        
formatex(DENSITY9"0.00%d"clamp(FOG_DENSITY199))
        
        
fm_set_kvd(fog"density"DENSITY"env_fog")
        
fm_set_kvd(fog"rendercolor"FOG_COLOR"env_fog")
    }
    
#endif
}

public 
plugin_init()
{
    if(!
get_pcvar_num(cvar_enabled)) return
    
    
cvar_gamedescription  register_cvar("bh_gamedescription",   "Biohazard")
    
cvar_skyname          register_cvar("bh_skyname",           "night")
    
cvar_lights          register_cvar("bh_lights",          "d")
    
cvar_blocknightvision register_cvar("bh_block_nvg",          "1")
    
cvar_starttime          register_cvar("bh_starttime",           "10.0")
    
cvar_randomspawn      register_cvar("bh_randomspawn",       "1")
    
cvar_customsounds     register_cvar("bh_customsounds",      "1")
    
cvar_winsounds          register_cvar("bh_winsounds",           "1")
    
cvar_autonvg          register_cvar("bh_autonvg",          "1")
    
cvar_killbonus          register_cvar("bh_zombie_kill_bonus""2")
    
cvar_buytime          register_cvar("bh_buytime",           "0")
    
cvar_weaponsmenu      register_cvar("bh_weaponsmenu",       "0")
    
cvar_ammo             register_cvar("bh_ammo",           "1")
    
cvar_hedmg_multi      register_cvar("bh_hedmg_multi",       "1.0")
    
cvar_maxzombies       register_cvar("bh_maxzombies",           "25")
    
cvar_flashbang           register_cvar("bh_flashbang",           "1")
    
cvar_zombie_instant   register_cvar("bh_zombie_instant",    "1")
    
cvar_zombie_hp          register_cvar("bh_zombie_hp",           "135")
    
cvar_knockback_hp     register_cvar("bh_zombie_kb_hp",      "90")
    
cvar_knockback_duck   register_cvar("bh_zombie_kb_duck",    "1")
    
cvar_hpbonus          register_cvar("bh_zombie_hp_bonus",   "65")
    
cvar_zombie_resist    register_cvar("bh_zombie_resist",     "1")
    
cvar_zombie_spd       register_cvar("bh_zombie_speed",      "280.0")
    
cvar_zombie_atk       register_cvar("bh_zombie_atk_multi",  "2.0")
    
cvar_zombie_def       register_cvar("bh_zombie_def_multi",  "0.087")
    
cvar_zombie_regen     register_cvar("bh_zombie_regen",      "1")
    
cvar_regen_dly1       register_cvar("bh_zombie_regendly1",  "2.0")
    
cvar_regen_dly2       register_cvar("bh_zombie_regendly2",  "0.25")
    
cvar_botquota          get_cvar_pointer("bot_quota")
    
cvar_autobalance[0]   = get_cvar_pointer("mp_autoteambalance")
    
cvar_autobalance[1]   = get_pcvar_num(cvar_autobalance[0])
    
set_pcvar_num(cvar_autobalance[0], 0)

    
register_clcmd("nightvision""cmd_nightvision")
    
register_clcmd("chooseteam",  "cmd_chooseteam")
    
register_clcmd("say guns",    "cmd_enablemenu")
    
register_clcmd("say /guns",   "cmd_enablemenu")
    
register_clcmd("amx_infect",  "cmd_infectuser"ADMIN_BAN"<name or #userid>")

    
RegisterHam(Ham_Use,                  "func_tank",       "bacon_use")
    
RegisterHam(Ham_Use,                  "func_tankmortar""bacon_use")
    
RegisterHam(Ham_Use,                  "func_tankrocket""bacon_use")
    
RegisterHam(Ham_Use,                  "func_tanklaser",  "bacon_use")
    
RegisterHam(Ham_Touch,                 "weaponbox",       "bacon_touch_weapon")
    
RegisterHam(Ham_Touch,               "armoury_entity",  "bacon_touch_weapon")
    
RegisterHam(Ham_Touch,               "weapon_shield",   "bacon_touch_weapon")
    
RegisterHam(Ham_Item_Deploy,          "weapon_knife",    "bacon_item_deploy_post",       1)
    
RegisterHam(Ham_Item_AttachToPlayer"weapon_knife",     "bacon_item_attachtoplayer_post"1)

    
unregister_forward(FM_Spawn,         g_fwd_spawn)
    
register_forward(FM_PlayerPreThink,    "fwd_playerprethink")
    
register_forward(FM_PlayerPostThink,    "fwd_playerpostthink")
    
register_forward(FM_CmdStart,        "fwd_cmdstart")
    
register_forward(FM_EmitSound,        "fwd_emitsound")
    
register_forward(FM_GetGameDescription"fwd_gamedescription")
    
register_forward(FM_CreateNamedEntity,    "fwd_createnamedentity")
    
register_forward(FM_Sys_Error,        "fwd_sys_error")
    
register_forward(FM_PlayerPreThink,    "fwd_playerprethink_post"1)
    
register_forward(FM_TraceLine,        "fwd_traceline_post",        1)
    
register_forward(FM_TraceHull,         "fwd_tracehull_post",        1)

    
register_message(get_user_msgid("AmmoX"),     "msg_ammox")
    
register_message(get_user_msgid("CurWeapon"),     "msg_curweapon")
    
register_message(get_user_msgid("TextMsg"),     "msg_textmsg")
    
register_message(get_user_msgid("SendAudio"),     "msg_sendaudio")
    
register_message(get_user_msgid("StatusIcon"),     "msg_statusicon")
    
register_message(get_user_msgid("ScoreAttrib"), "msg_scoreattrib")
    
register_message(get_user_msgid("DeathMsg"),     "msg_deathmsg")
    
register_message(get_user_msgid("ScreenFade"),     "msg_screenfade")
    
register_message(get_user_msgid("TeamInfo"),     "msg_teaminfo")
    
register_message(get_user_msgid("ClCorpse"),     "msg_clcorpse")
    
    
register_event("TextMsg",   "event_textmsg",   "a",  "2=#Game_will_restart_in")
    
register_event("HLTV",      "event_newround",  "a",  "1=0""2=0")
    
register_event("Damage",    "event_damage",    "be")
    
register_event("Battery",   "event_battery",   "be")

    
register_logevent("logevent_round_start"2"1=Round_Start")
    
register_logevent("logevent_round_end",   2"1=Round_End")
    
    
g_fwd_infect     CreateMultiForward("event_infect",     ET_CONTINUEFP_CELLFP_CELL)
    
g_fwd_infect2     CreateMultiForward("event_infect2",     ET_CONTINUEFP_CELL)
    
g_fwd_teamwin     CreateMultiForward("event_teamwin",     ET_CONTINUEFP_CELL)
    
g_fwd_gamestart CreateMultiForward("event_gamestart"ET_CONTINUE)
    
g_maxplayers     get_maxplayers()
    
    
register_dictionary("biohazard.txt")
    
build_menu(), get_spawnpoints()

    new 
modname[7]; get_modname(modname6)
    
g_czero equal(modname,"czero") ? true false
}

public 
pdata_init(id)
{
    
RegisterHamFromEntity(Ham_TakeDamageid"bacon_takedamage")
    
RegisterHamFromEntity(Ham_Spawn,      id"bacon_spawn_post"1)
}

public 
build_menu()
{
    new 
title[32]
    
formatex(title31"%L"LANG_SERVER"MENU_TITLE1")
    
g_equipmenu menu_create(title"menu_equip"0)
        
    
formatex(title31"%L"LANG_SERVER"MENU_TITLE2")
    
g_primmenu  menu_create(title,    "menu_prim"0)
    
    
formatex(title31"%L"LANG_SERVER"MENU_TITLE3")
    
g_secmenu   menu_create(title,  "menu_sec",  0)

    new 
name[32]
    
formatex(name31"%L"LANG_SERVER"MENU_NEWWEAPONS")
    
menu_additem(g_equipmenuname"1"0, -1)
    
    
formatex(name31"%L"LANG_SERVER"MENU_PREVSETUP")
    
menu_additem(g_equipmenuname"2"0, -1)
    
    
formatex(name31"%L"LANG_SERVER"MENU_DONTSHOW")
    
menu_additem(g_equipmenuname"3"0, -1)
    
    static 
inum[3]
    for(
1sizeof g_primmenunamesi++)
    {
        
formatex(num2"%d"i)
        
menu_additem(g_primmenug_primmenunames[i], num0, -1)
    }
    
    for(
1sizeof g_secmenunamesi++)
    {
        
formatex(num2"%d"i)
        
menu_additem(g_secmenug_secmenunames[i], num0, -1)
    }
    return 
PLUGIN_HANDLED
}

public 
plugin_cfg()
{
    new 
file[64]; get_configsdir(file63)
    
format(file63"%s/bh_cvars.cfg"file)
    if(
file_exists(file)) server_cmd("exec %s"file), server_exec()
    
    new 
light[2]
    
get_pcvar_string(cvar_lightslight1)
    
    if(
strlen(light) > 0)
    {
        
set_task(1.0"task_lights"___"b")
        
        
set_cvar_num("sv_skycolor_r"0)
        
set_cvar_num("sv_skycolor_g"0)
        
set_cvar_num("sv_skycolor_b"0)
    }
        
    new 
skyname[32]
    
get_pcvar_string(cvar_skynameskyname31)
        
    if(
strlen(skyname) > 0)
        
set_cvar_string("sv_skyname"skyname)
}

public 
plugin_end()
    
set_pcvar_num(cvar_autobalance[0], cvar_autobalance[1]), destroyforwards()

public 
destroyforwards()
{
    
DestroyForward(g_fwd_infect),  DestroyForward(g_fwd_infect2)
    
DestroyForward(g_fwd_teamwin), DestroyForward(g_fwd_gamestart)
}

public 
plugin_natives()
{
    
register_library("biohazardf")
    
register_native("is_game_started",     "native_game_started")
    
register_native("is_user_zombie",      "native_is_user_zombie")
    
register_native("is_user_firstzombie""native_is_user_firstzombie")
    
register_native("infect_user",         "native_infect_user")
    
register_native("firstzombie",         "native_first_zombie")
}

public 
client_connect(id)
{
    
g_lastteam[id] = -1remove_model(g_modelent[id])
    
g_showmenu[id] = trueclear_clientdata(id)
}

public 
client_putinserver(id)
{
    if(!
g_netclient_pdataset_task(1.0"task_netclient_pdata"id)
    if(
g_czero && !g_botclient_pdataset_task(1.0"task_botclient_pdata"id)
}

public 
client_disconnect(id)
{
    
remove_task(TASKID_SETZOMBIE id), remove_task(TASKID_STRIPNGIVE id)
    
remove_task(TASKID_UPDATESCR id), remove_task(TASKID_SPAWNDELAY id)
    
remove_task(TASKID_GIVENADES id), remove_model(g_modelent[id])
}

public 
clear_clientdata(id)
{
    
g_victim[id] = 0g_regendelay[id] = 0.0
    g_lastteam
[id] = 0g_weaponent[id] = 0
    g_zombie
[id] = falseg_falling[id] = false
}

public 
remove_model(ent)
{
    static 
idid pev(entpev_owner)
    if(
pev_valid(ent)) engfunc(EngFunc_RemoveEntityent)
    
g_modelent[id] = 0
}

public 
cmd_enablemenu(id)
{    
    if(!
get_pcvar_num(cvar_weaponsmenu))
        return 
PLUGIN_CONTINUE
    
    client_print
(idprint_chat"%L"idg_showmenu[id] == false "MENU_REENABLED" "MENU_ALENABLED")
    
g_showmenu[id] = true

    
return PLUGIN_HANDLED_MAIN
}

public 
cmd_nightvision(id)
    return (!
g_zombie[id] && get_pcvar_num(cvar_blocknightvision)) ? PLUGIN_HANDLED PLUGIN_CONTINUE

public cmd_chooseteam(id)
    return 
g_zombie[id] ? PLUGIN_HANDLED PLUGIN_CONTINUE

public cmd_infectuser(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED_MAIN
    
    
static arg1[32], target
    read_argv
(1arg131)
    
    
target cmd_target(idarg10)
    if(!
is_user_alive(target))
    {
        
console_print(id"%L"id"CMD_INVALIDUSER")
        return 
PLUGIN_HANDLED_MAIN
    
}
    
    if(!
allow_infection())
    {
        
console_print(id"%L"id"CMD_MAXZOMBIES")
        return 
PLUGIN_HANDLED_MAIN
    
}
    
    if(!
g_gamestarted)
    {
        
console_print(id"%L"id"CMD_NOTSTARTED")
        return 
PLUGIN_HANDLED_MAIN
    
}
    
    if(!
g_zombie[target])
    {
        
infect_user(target)
        
        static 
name[32]; get_user_name(targetname31)
        
console_print(id"%L"id"CMD_INFECTED"name)
    }
    return 
PLUGIN_HANDLED_MAIN
}

public 
msg_teaminfo(msgiddestid)
{
    if(!
g_gamestarted)
        return 
PLUGIN_CONTINUE
    
    
static team[4]; get_msg_arg_string(2team3)
    if(
team[0] != 'U' || team[1] != 'N' || team[2] != 'A')
        return 
PLUGIN_CONTINUE

    id 
get_msg_arg_int(1)
    if(
is_user_alive(id) || g_lastteam[id] == -1)
        return 
PLUGIN_CONTINUE
    
    id 
randomly_pick_zombie()
    if(
id)
    {
        if(!
g_zombie[id])
        {
            
infect_user(id)
            
            static 
name[32]
            
get_user_name(idname31)

            
set_hudmessage(_____1)
            
show_hudmessage(0"%L"LANG_PLAYER"INFECTED_HUD"name)
        }
        else
        {
            
cs_set_user_team2(idCS_TEAM_CT)
            
set_pev(idpev_deadflagDEAD_DISCARDBODY)
        }
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
msg_screenfade(msgiddestid)
{
    if(!
get_pcvar_num(cvar_flashbang) || !is_user_connected(id))
        return 
PLUGIN_CONTINUE
    
    
if(!g_zombie[id] || !is_user_alive(id))
    {
        static 
data[4]
        
data[0] = get_msg_arg_int(4); data[1] = get_msg_arg_int(5)
        
data[2] = get_msg_arg_int(6); data[3] = get_msg_arg_int(7)
        
        if(
data[0] == 255 && data[1] == 255 && data[2] == 255 && data[3] > 199)
            return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
msg_scoreattrib(msgiddestid)
{
    static 
attribattrib get_msg_arg_int(2)
    if(
attrib == ATTRIB_BOMB)
        
set_msg_arg_int(2ARG_BYTE0)
}

public 
msg_deathmsg(msgiddestid
{
    static 
killerkiller get_msg_arg_int(1)
    static 
victimvictim get_msg_arg_int(2)
    if(!
is_user_connected(killer))
        return 
PLUGIN_CONTINUE
    
    
if(g_zombie[killer]) 
        
set_msg_arg_string(4g_zombie_weapname)

    else if(
g_zombie[victim])
        
set_pev(killerpev_fragspev(killerpev_frags) + float(get_pcvar_num(cvar_killbonus)))

    return 
PLUGIN_CONTINUE
}

public 
msg_statusicon(msgiddestid)
{
    if(!
is_user_connected(id))
        return 
PLUGIN_CONTINUE
    
    
static icon[8]; get_msg_arg_string(2icon7)
    if(
icon[0] == 'c' && icon[1] == '4' || equal(icon"defuser"))
        return 
PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE
}

public 
msg_sendaudio(msgiddestid)
{
    static 
audiocode [22]; get_msg_arg_string(2audiocode21)
    if(
equal(audiocode[7], "terwin") && get_pcvar_num(cvar_winsounds))
        
set_msg_arg_string(2g_zombie_win_sounds[_random(sizeof g_zombie_win_sounds)])
    
    return 
PLUGIN_CONTINUE
}

public 
msg_textmsg(msgiddestid)
{
    if(
get_msg_arg_int(1) != 4)
        return 
PLUGIN_CONTINUE
    
    
static txtmsg[25], winmsg[32]
    
get_msg_arg_string(2txtmsg24)
    
    if(
equal(txtmsg[1], "Game_bomb_drop"))
        return 
PLUGIN_HANDLED

    
else if(equal(txtmsg[1], "Terrorists_Win"))
    {
        
formatex(winmsg31"%L"LANG_SERVER"WIN_ZOMBIES")
        
set_msg_arg_string(2winmsg)
        
        
g_winningteam CS_TEAM_T
    
}
    else if(
equal(txtmsg[1], "Target_Saved") || equal(txtmsg[1], "CTs_Win"))
    {
        
formatex(winmsg31"%L"LANG_SERVER"WIN_SURVIVORS")
        
set_msg_arg_string(2winmsg)
        
        
g_winningteam CS_TEAM_CT
    
}
    return 
PLUGIN_CONTINUE
}

public 
msg_ammox(msgiddestid)
{
    static 
ammotypeammotype get_pcvar_num(cvar_ammo)
    if(!
is_user_alive(id) || g_zombie[id] || ammotype != 1)
        return 
PLUGIN_CONTINUE
    
    
static ammoidammoid get_msg_arg_int(1)
    static 
bammobammo get_msg_arg_int(2)
    
    if(!(
AMMOID_NULL & (1<<ammoid)) && bammo != MAX_AMMO)
        
set_msg_arg_int(2ARG_BYTEMAX_AMMO)

    return 
PLUGIN_CONTINUE
}

public 
msg_curweapon(msgiddestid)
{
    if(!
is_user_alive(id) || !get_msg_arg_int(1))
        return 
PLUGIN_CONTINUE
    
    
static weaponweapon get_msg_arg_int(2)
    if(
g_zombie[id])
    {
        if(
weapon != CSW_KNIFE && !task_exists(TASKID_STRIPNGIVE id))
            
set_task(0.2"task_stripngive"TASKID_STRIPNGIVE id)
        
        return 
PLUGIN_CONTINUE
    
}
    else if(
AMMOWP_NULL & (1<<weapon)) return PLUGIN_CONTINUE

    
static ammotypeammotype get_pcvar_num(cvar_ammo)
    if(!
ammotype) return PLUGIN_CONTINUE
    
    
static max_clipmax_clip get_weapon_maxclip(weapon)
    switch(
ammotype)
    {
        case 
1:
        {
            static 
ammoammo get_user_bpammo(idweapon)
            if(
ammo max_clipset_user_bpammo(idweaponMAX_AMMO)
        }
        case 
2:
        {
            static 
clipclip get_msg_arg_int(3)
            if(
clip != max_clipset_msg_arg_int(3ARG_BYTEmax_clip)
            
            if(!
pev_valid(g_weaponent[id]) || (pev_valid(g_weaponent[id])
            && 
cs_get_weapon_id(g_weaponent[id]) != weapon))
            {
                static 
weaponname[32]; get_weaponname(weaponweaponname31)
                
g_weaponent[id] = fm_find_ent_by_owner(-1weaponnameid)
            }
            
            if(
clip && pev_valid(g_weaponent[id]))
                
set_weapon_ammo(g_weaponent[id], max_clip)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
msg_clcorpse(msgiddestid)
{
    
id get_msg_arg_int(12)
    if(!
g_zombie[id])
        return 
PLUGIN_CONTINUE

    
static entent fm_find_ent_by_owner(-1MODEL_CLASSNAMEid)
    if(
pev_valid(ent))
    {
        static 
model[64]
        
pev(entpev_modelmodel63)
        
set_msg_arg_string(1model)
    }
    return 
PLUGIN_CONTINUE
}

public 
logevent_round_start()
{
    
g_roundstarted true
    
if(get_pcvar_num(cvar_weaponsmenu))
    {
        static 
idCsTeams:team
        
for(id 1id <= g_maxplayersid++) if(is_user_alive(id))
        {
            
team cs_get_user_team(id)
            if(
team == CS_TEAM_T || team == CS_TEAM_CT)
                
g_showmenu[id] == true menu_display(idg_equipmenu0) : equipweapon(idEQUIP_ALL)
        }
    }
}

public 
logevent_round_end()
{
    
g_gamestarted falseg_roundstarted false
    remove_task
(TASKID_BALANCETEAM), remove_task(TASKID_STARTROUND)
    
set_task(1.5"task_balanceteam"TASKID_BALANCETEAM)
    
    if(
g_winningteam CS_TEAM_UNASSIGNED)
    {
        
ExecuteForward(g_fwd_teamwing_fwd_resultg_winningteam)
        
g_winningteam CS_TEAM_UNASSIGNED
    
}
}

public 
event_textmsg()
{
    static 
seconds[5]; read_data(3seconds4)
    static 
Float:tasktimetasktime float(str_to_num(seconds)) - 0.5
    remove_task
(TASKID_BALANCETEAM), set_task(tasktime"task_balanceteam"TASKID_BALANCETEAM)
}

public 
event_newround()
{
    static 
buytimebuytime get_pcvar_num(cvar_buytime)
    if(
buytimeg_buytime buytime get_gametime()
    
    
g_gamestarted falseg_roundstarted false
    remove_task
(TASKID_NEWROUND), remove_task(TASKID_STARTROUND)
    
    
set_task(0.1"task_newround"TASKID_NEWROUND)
    
set_task(get_pcvar_float(cvar_starttime), "task_startround"TASKID_STARTROUND)
}

public 
event_battery(id)
{
    static 
armorarmor read_data(1)
    if(
armor 0)
    {
        if(!
is_user_alive(id) || !g_zombie[id])
            return 
PLUGIN_CONTINUE
        
        
static CsArmorType:armortype
        cs_get_user_armor2
(idarmortype)
        
        if(
armortype != CS_ARMOR_NONE)
            
cs_set_user_armor2(id0CS_ARMOR_NONE)
    }
    return 
PLUGIN_CONTINUE
}

public 
event_damage(victim)
{
    if(!
is_user_alive(victim) || !g_gamestarted)
        return 
PLUGIN_CONTINUE
    
    
if(g_zombie[victim])
    {
        
g_regendelay[victim] = get_gametime() + get_pcvar_float(cvar_regen_dly1)
        return 
PLUGIN_CONTINUE
    
}
    
    static 
attackerattacker get_user_attacker(victim)
    if(!
is_user_alive(attacker) || !g_zombie[attacker] || g_infecting)
        return 
PLUGIN_CONTINUE
    
    g_infecting 
true
    
if(g_victim[attacker] == victim)
    {
        static 
Float:fragspev(attackerpev_fragsfrags)
        static 
deathsdeaths cs_get_user_deaths(victim)
        
set_pev(attackerpev_fragsfrags  1.0)
        
set_user_deaths(victimdeaths 1)
                    
        static 
_msg_deathmsg
        
if(!_msg_deathmsg_msg_deathmsg get_user_msgid("DeathMsg")
        
        
message_begin(MSG_BROADCAST_msg_deathmsg)
        
write_byte(attacker)
        
write_byte(victim)
        
write_byte(0)
        
write_string("infection")
        
message_end()
                    
        
infect_user(victim)
        
ExecuteForward(g_fwd_infectg_fwd_resultattackervictim)

        static 
params[2]; params[0] = attackerparams[1] = victim
        set_task
(0.2"task_updatescore"TASKID_UPDATESCRparams2)
        
        
g_victim[attacker] = 0
    
}
    
g_infecting false
    
    
return PLUGIN_CONTINUE
}

public 
fwd_emitsound(idchannelsample[], Float:volumeFloat:attnflagpitch)
{    
    if(
sample[6] == 'n' && sample[7] == 'v' && sample[8] == 'g')
        return 
FMRES_SUPERCEDE
    
    
if(!is_user_connected(id) || !g_zombie[id])
        return 
FMRES_IGNORED
    
    
if(sample[8] == 'k' && sample[9] == 'n' && sample[10] == 'i' && get_pcvar_num(cvar_customsounds))
    {
        if(
sample[14] == 's' && sample[15] == 'l' && sample[16] == 'a')
        {
            
emit_sound(idchannelg_zombie_miss_sounds[_random(sizeof g_zombie_miss_sounds)], volumeattnflagpitch)
            return 
FMRES_SUPERCEDE
        
}
        else if(
sample[14] == 'h' && sample[15] == 'i' && sample[16] == 't' || sample[14] == 's' && sample[15] == 't' && sample[16] == 'a')
        {
            if(
sample[17] == 'w' && sample[18] == 'a' && sample[19] == 'l')
                
emit_sound(idchannelg_zombie_miss_sounds[_random(sizeof g_zombie_miss_sounds)], volumeattnflagpitch)
            else
                
emit_sound(idchannelg_zombie_hit_sounds[_random(sizeof g_zombie_hit_sounds)], volumeattnflagpitch)
            
            return 
FMRES_SUPERCEDE
        
}
    }            
    else if(
sample[7] == 'd' && (sample[8] == 'i' && sample[9] == 'e' || sample[12] == '6'))
    {
        
emit_sound(idchannelg_zombie_die_sounds[_random(sizeof g_zombie_die_sounds)], volumeattnflagpitch)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}

public 
fwd_cmdstart(idhandleseed)
{
    if(!
is_user_alive(id) || !g_zombie[id])
        return 
FMRES_IGNORED
    
    
static impulseimpulse get_uc(handleUC_Impulse)
    if(
impulse == IMPULSE_FLASHLIGHT)
    {
        
set_uc(handleUC_Impulse0)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}

public 
fwd_playerprethink(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED
    
    
static flagflag pev(idpev_flags)
    if(
get_pcvar_num(cvar_zombie_resist))
    {
        if(
flag FL_ONGROUND)
        {
            
pev(idpev_velocityg_vecvel)
            
g_brestorevel true
        
}
    }

    if(
g_zombie[id])
    {
        if(!(
flag FL_ONGROUND))
        {
            static 
Float:fallvelocitypev(idpev_flFallVelocityfallvelocity)
            
g_falling[id] = fallvelocity >= 350.0 true false
        
}
        
        if(
get_pcvar_num(cvar_zombie_regen))
        {
            static 
Float:healthpev(idpev_healthhealth)
            static 
Float:zombiehpzombiehp float(get_pcvar_num(cvar_zombie_hp))
            if(
health zombiehp)
            {
                static 
Float:gametimegametime get_gametime()
                if(
g_regendelay[id] < gametime)
                {
                    
set_pev(idpev_healthhealth 1.0)
                    
g_regendelay[id] = gametime get_pcvar_float(cvar_regen_dly2)
                }
            }
        }
        
        static 
entent g_modelent[id]
        if(
pev_valid(ent))
        {
            if(!(
pev(entpev_effects) & EF_NODRAW))
            {
                if(
pev(idpev_rendermode) != kRenderTransTexture)
                    
set_pev(idpev_rendermodekRenderTransTexture)
                
                if(
pev(idpev_renderamt) != 0.0)
                    
set_pev(idpev_renderamt0.0)
            }
        }
    }
    return 
FMRES_IGNORED
}

public 
fwd_playerprethink_post(id)
{
    if(!
g_brestorevel)
        return 
FMRES_IGNORED

    g_brestorevel 
false
        
    
static flagflag pev(idpev_flags)
    if(!(
flag FL_ONTRAIN))
    {
        static 
entent pev(idpev_groundentity)
        if(
pev_valid(ent) && (flag FL_CONVEYOR))
        {
            static 
Float:vectemp[3]
            
pev(idpev_basevelocityvectemp)
            
xs_vec_add(g_vecvelvectempg_vecvel)
        }
            
        if(
g_zombie[id]) 
        {
            static 
Float:healthpev(idpev_healthhealth)
            static 
Float:kbhpkbhp float(get_pcvar_num(cvar_knockback_hp))
            if(
get_pcvar_num(cvar_knockback_duck))
            {
                if(
pev(idpev_flags) & FL_DUCKING)
                    
set_pev(idpev_velocityg_vecvel)
                else if(
health kbhp
                    
set_pev(idpev_velocityg_vecvel)
            }
            else if(
health kbhpset_pev(idpev_velocityg_vecvel)
        }
        return 
FMRES_HANDLED
    
}
    return 
FMRES_IGNORED
}

public 
fwd_playerpostthink(id)

    if(!
is_user_alive(id)) 
        return 
FMRES_IGNORED
    
    
if(g_falling[id] && pev(idpev_flags) & FL_ONGROUND)
        
set_pev(idpev_watertypeCONTENTS_WATER), g_falling[id] = false
    
    
if(get_pcvar_num(cvar_buytime))
    {
        if(
g_buytime get_gametime() && pev_valid(g_buyzone) && !g_zombie[id])
            
dllfunc(DLLFunc_Touchg_buyzoneid)
    }
    return 
FMRES_IGNORED
}
    
public 
fwd_spawn(ent)
{
    if(!
pev_valid(ent)) 
        return 
FMRES_IGNORED
    
    
static objective_ents[][] = 
    { 
        
"func_bomb_target",    "info_bomb_target"
        
"hostage_entity",      "monster_scientist"
        
"func_hostage_rescue""info_hostage_rescue",
        
"info_vip_start",      "func_vip_safetyzone"
        
"func_escapezone",     "func_buyzone"
    
}

    static 
classname[32], i
    pev
(entpev_classnameclassname31)

    for(
0sizeof objective_ents; ++i)
    {
        if(
equal(classnameobjective_ents[i]))
        {
            
engfunc(EngFunc_RemoveEntityent)
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

public 
fwd_gamedescription() 

    static 
gamename[32]
    
get_pcvar_string(cvar_gamedescriptiongamename31)
    
forward_return(FMV_STRINGgamename)
    
    return 
FMRES_SUPERCEDE
}  

public 
fwd_traceline_post(Float:start[3], Float:end[3], nomonstersidtrace)
{
    if(
g_gamestarted || !is_player_alive(id))
        return 
FMRES_IGNORED
    
    
static targettarget get_tr2(traceTR_pHit)
    if(
is_player_alive(target))
        
set_tr2(traceTR_flFraction1.0)

    return 
FMRES_IGNORED
}

public 
fwd_tracehull_post(Float:start[3], Float:end[3], nomonstershullidtrace)
{
    if(
g_gamestarted || !is_player_alive(id))
        return 
FMRES_IGNORED

    
static targettarget get_tr2(traceTR_pHit)
    if(
is_player_alive(target))
        
set_tr2(traceTR_flFraction1.0)
    
    return 
FMRES_IGNORED
}

public 
fwd_createnamedentity(entclassname)
{
    static 
classname[10]; engfunc(EngFunc_SzFromIndexentclassnameclassname9)
    return (
classname[7] == 'c' && classname[8] == '4') ? FMRES_SUPERCEDE FMRES_IGNORED
}

public 
fwd_sys_error()
    
destroyforwards()

public 
bacon_item_attachtoplayer_post(entid)
{
    if(
is_user_alive(id) && g_zombie[id])
        
weapon_deployed(id)
}

public 
bacon_item_deploy_post(ent)
{
    static 
idid pev(entpev_owner)
    if(
is_user_alive(id) && g_zombie[id])
        
weapon_deployed(id)
}

public 
weapon_deployed(id)
{
    
set_pev(idpev_weaponmodel2"")
    if(
g_usingknifemodel
        
set_pev(idpev_viewmodel2g_zombie_claws)
    
    
set_pev(idpev_maxspeedget_pcvar_float(cvar_zombie_spd))
}

public 
bacon_use(entcalleractivatoruse_typeFloat:value)
    return (
use_type == && is_player_alive(caller) && g_zombie[caller]) ? HAM_SUPERCEDE HAM_IGNORED

public bacon_takedamage(victiminflictorattackerFloat:damagedamagetype)
{
    if(
damagetype DMG_GENERIC || victim == attacker || !is_user_alive(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED

    
if(!g_gamestarted || (!g_zombie[victim] && !g_zombie[attacker]) || ((damagetype DMG_HEGRENADE) && g_zombie[attacker]))
    {
        
SetHamParamFloat(40.0)
        return 
HAM_HANDLED
    
}
    
    static 
CsTeams:team[2]; team[0] = cs_get_user_team(attacker), team[1] = cs_get_user_team(victim)
    if(
team[0] == team[1]) return HAM_IGNORED
    
    
if(!g_zombie[attacker])
    {
        
damage *= (damagetype DMG_HEGRENADE) ? get_pcvar_float(cvar_hedmg_multi) : get_pcvar_float(cvar_zombie_def)
        
SetHamParamFloat(4damage)

        return 
HAM_HANDLED
    
}
    else 
    {
        if(
get_user_weapon(attacker) != CSW_KNIFE)
            
SetHamParamFloat(40.0)
        else
        {
            static 
bool:infectinfect allow_infection()
            if(!
get_pcvar_num(cvar_zombie_instant))
            {
                static 
Float:healthpev(victimpev_healthhealth)
                if(
health damage)  infect false
            
}       else if(g_infectinginfect false
            g_victim
[attacker] = infect victim 0
            damage 
*= get_pcvar_float(cvar_zombie_atk)
            
SetHamParamFloat(4infect 0.0 damage)
        }
        return 
HAM_HANDLED
    
}
    return 
HAM_IGNORED
}

public 
bacon_spawn_post(id) if(is_user_alive(id))
{
    if(
g_zombie[id])
    {
        
clear_clientdata(id), reset_user_model(id)
        if(
g_usingknifemodel)
        {
            static 
viewmodel[32]
            
pev(idpev_viewmodel2viewmodel31)
            if(
equal(viewmodelg_zombie_claws))
            {
                static 
weaponweapon fm_find_ent_by_owner(-1"weapon_knife"id)
                
ExecuteHamB(Ham_Item_Deployweapon)
            }
        }
    }
    
set_task(0.3"task_spawned"TASKID_SPAWNDELAY id)
}

public 
bacon_touch_weapon(entid)
    return (
is_player_alive(id) && g_zombie[id]) ? HAM_SUPERCEDE HAM_IGNORED

public task_spawned(taskid)
{
    static 
idid taskid TASKID_SPAWNDELAY
    
if(is_user_alive(id))
    {
        if(
g_gamestarted)
        {
            static 
CsTeams:teamteam cs_get_user_team(id)
            if(
team == CS_TEAM_Tcs_set_user_team2(idCS_TEAM_CT)
        }
        
        if(
get_pcvar_num(cvar_weaponsmenu) && g_roundstarted && g_showmenu[id])
            
menu_display(idg_equipmenu0)
    }
}

public 
task_lights()
{
    static 
light[2]
    
get_pcvar_string(cvar_lightslight1)
    
engfunc(EngFunc_LightStyle0light)
}

public 
task_setzombie(taskid)
{
    static 
idid taskid TASKID_SETZOMBIE
    set_zombie_attibutes
(id)
}

public 
task_updatescore(params[])
{
    if(!
g_gamestarted) return
    
    static 
attackerattacker params[0]
    static 
victimvictim params[1]
    
    if(!
is_user_connected(attacker))
        return
    
    static 
fragsdeathsteam
    frags  
get_user_frags(attacker)
    
deaths cs_get_user_deaths(attacker)
    
team   get_user_team(attacker)
    
    static 
msg_scoreinfo
    
if(!msg_scoreinfomsg_scoreinfo get_user_msgid("ScoreInfo")
    
    
message_begin(MSG_BROADCASTmsg_scoreinfo)
    
write_byte(attacker)
    
write_short(frags)
    
write_short(deaths)
    
write_short(0)
    
write_short(team)
    
message_end()
    
    if(!
is_user_connected(victim))
        return
    
    
frags  get_user_frags(victim)
    
deaths cs_get_user_deaths(victim)
    
team   get_user_team(victim)
    
    
message_begin(MSG_BROADCASTmsg_scoreinfo)
    
write_byte(victim)
    
write_short(frags)
    
write_short(deaths)
    
write_short(0)
    
write_short(team)
    
message_end()
}

public 
task_stripngive(taskid)
{
    static 
idid taskid TASKID_STRIPNGIVE
    
if(is_user_alive(id))
    {
        
fm_strip_user_weapons(id), reset_user_primary(id)
        
bacon_give_weapon(id"weapon_knife")
    }
}

public 
task_newround()
{
    static 
players[32], numiidnewzombie
    get_players
(playersnum"a")

    
newzombie players[_random(num)]
    if(
num && is_user_connected(g_zombieoftheround))
    {
        while(
g_zombieoftheround == newzombie)
            
newzombie players[_random(num)]
    }
    
g_zombieoftheround newzombie

    
for(0numi++)
    {
        
id players[i]
        
client_print(idprint_chat"%L %L"id"SCAN_RESULTS"idg_zombieoftheround == id "SCAN_INFECTED" "SCAN_CLEAN")
    }
    
    if(
get_pcvar_num(cvar_randomspawn))
        
randomly_place_everyone()
}

public 
task_startround()
{
    static 
players[32], numiidnewzombie
    get_players
(playersnum"a")
    
    if(
num && !is_user_alive(g_zombieoftheround))
    {
        
newzombie players[_random(num)]
        while(
g_zombieoftheround == newzombie)
            
newzombie players[_random(num)]
        
        
g_zombieoftheround newzombie
    
}
    
    if(!
g_zombieoftheround) return
    
    for(
0numi++)
    {
        
id players[i]
        
id == g_zombieoftheround infect_user(id) : cs_set_user_team2(idCS_TEAM_CT)
    }
    
    static 
name[32]
    
get_user_name(g_zombieoftheroundname31)

    
set_hudmessage(_____1)
    
show_hudmessage(0"%L"LANG_PLAYER"INFECTED_HUD"name)
    
client_print(0print_chat"%L"LANG_PLAYER"INFECTED_TXT"name)
    
    
g_gamestarted trueExecuteForward(g_fwd_gamestartg_fwd_result)
}

public 
task_balanceteam()
{
    static 
players[CsTeams:3][32], count[CsTeams:3], iidCsTeams:team
    get_players
(players[CS_TEAM_UNASSIGNED], count[CS_TEAM_UNASSIGNED])
    
count[CS_TEAM_T] = 0count[CS_TEAM_CT] = 0
    
    
for(0count[CS_TEAM_UNASSIGNED]; i++)
    {
        
id players[CS_TEAM_UNASSIGNED][i], team cs_get_user_team(id)
        if(
team == CS_TEAM_T || team == CS_TEAM_CT)
            
players[team][count[team]++] = id
    
}

    if(
abs(count[CS_TEAM_T] - count[CS_TEAM_CT]) <= 1) return

    static 
maxplayersmaxplayers = (count[CS_TEAM_T] + count[CS_TEAM_CT]) / 2
    
if(count[CS_TEAM_T] > maxplayers)
    {
        for(
0< (count[CS_TEAM_T] - maxplayers); i++)
            
cs_set_user_team(players[CS_TEAM_T][i], CS_TEAM_CT)
    }
    else
    {
        for(
0< (count[CS_TEAM_CT] - maxplayers); i++)
            
cs_set_user_team(players[CS_TEAM_CT][i], CS_TEAM_T)
    }
}

public 
task_givenades(taskid)
{
    static 
idiid taskid TASKID_GIVENADES
    
if(is_user_alive(id) && (strlen(g_grenades[0]) > 0))
    {
        for(
0sizeof g_grenadesi++)
            
bacon_give_weapon(idg_grenades[i])
    }
}

public 
task_netclient_pdata(id) if(!g_netclient_pdata && is_user_connected(id))
{
    if(!
g_czero || !(pev(idpev_flags) & FL_FAKECLIENT) || !get_pcvar_num(cvar_botquota))
        
pdata_init(id), g_netclient_pdata 1
}

public 
task_botclient_pdata(id) if(!g_botclient_pdata && is_user_connected(id))
{
    if((
pev(id,pev_flags) & FL_FAKECLIENT) && get_pcvar_num(cvar_botquota))
        
pdata_init(id), g_botclient_pdata 1
}

public 
infect_user(id)
{
    if(!
is_user_alive(id)) return

    static 
_msg_scoreattrib
    
if(!_msg_scoreattrib_msg_scoreattrib get_user_msgid("ScoreAttrib")
    
    
message_begin(MSG_BROADCAST_msg_scoreattrib)
    
write_byte(id)
    
write_byte(0)
    
message_end()
    
    static 
soundsound _random(sizeof g_scream_sounds)
    
emit_sound(idCHAN_STATICg_scream_sounds[sound], VOL_NORMATTN_NONE0PITCH_NORM)
    
    
menu_cancel(id), cs_set_user_team2(idCS_TEAM_T)
    
set_task(0.1"task_setzombie"TASKID_SETZOMBIE id)
}

public 
menu_equip(idmenuitem)
{
    if(
item 0) return PLUGIN_CONTINUE
    
    
static cmd[2], name[64], accesscallbackkey
    menu_item_getinfo
(menuitemaccesscmd1name63callback), key str_to_num(cmd)
    
    switch(
key)
    {
        case 
1menu_display(idg_primmenu0)
        case 
2: (g_weapons[id][0] > 0) ? equipweapon(idEQUIP_ALL) : menu_display(idg_primmenu0)
        case 
3:
        {
            if(
g_weapons[id][0] > 0)
            {
                
g_showmenu[id] = false
                client_print
(idprint_chat"%L"id"MENU_CMDENABLE")
                
equipweapon(idEQUIP_ALL)
            }
            else    
menu_display(idg_primmenu0)
        }
    }
    return 
PLUGIN_HANDLED
}

public 
menu_prim(idmenuitem)
{
    if(
item 0) return PLUGIN_HANDLED
    
    
static cmd[6], name[64], accesscallback
    menu_item_getinfo
(menuitemaccesscmd5name63callback)
    
    
g_weapons[id][0] = str_to_num(cmd)
    
equipweapon(idEQUIP_PRI)
    
menu_display(idg_secmenu0)

    return 
PLUGIN_HANDLED
}

public 
menu_sec(idmenuitem)
{
    if(
item 0) return PLUGIN_HANDLED
    
    
static cmd[6], name[64], accesscallback
    menu_item_getinfo
(menuitemaccesscmd5name63callback)
    
    
g_weapons[id][1] = str_to_num(cmd)
    
equipweapon(idEQUIP_SEC)
    
equipweapon(idEQUIP_GREN)

    return 
PLUGIN_HANDLED
}

public 
randomly_place_everyone()
{
    if(
g_spawncount <= 0) return
    
    static 
players[32], numidiCsTeams:team
    get_players
(playersnum"a")

    for(
0numi++)
    {
        
id players[i]
        
team cs_get_user_team(id)
        
        if(
team != CS_TEAM_T && team != CS_TEAM_CT || pev(idpev_iuser1))
            continue
        
        static 
spawn_index
        spawn_index 
_random(g_spawncount)
    
        static 
Float:spawndata[3]
        
spawndata[0] = g_spawns[spawn_index][0]
        
spawndata[1] = g_spawns[spawn_index][1]
        
spawndata[2] = g_spawns[spawn_index][2]
        
        if(!
fm_is_hull_vacant(spawndataHULL_HUMAN))
        {
            static 
i
            
for(spawn_index 1!= spawn_indexi++)
            {
                if(
>= g_spawncount0

                spawndata
[0] = g_spawns[i][0]
                
spawndata[1] = g_spawns[i][1]
                
spawndata[2] = g_spawns[i][2]

                if(
fm_is_hull_vacant(spawndataHULL_HUMAN))
                {
                    
spawn_index i
                    
break
                }
            }
        }

        
spawndata[0] = g_spawns[spawn_index][0]
        
spawndata[1] = g_spawns[spawn_index][1]
        
spawndata[2] = g_spawns[spawn_index][2]
        
engfunc(EngFunc_SetOriginidspawndata)

        
spawndata[0] = g_spawns[spawn_index][3]
        
spawndata[1] = g_spawns[spawn_index][4]
        
spawndata[2] = g_spawns[spawn_index][5]
        
set_pev(idpev_anglesspawndata)

        
spawndata[0] = g_spawns[spawn_index][6]
        
spawndata[1] = g_spawns[spawn_index][7]
        
spawndata[2] = g_spawns[spawn_index][8]
        
set_pev(idpev_v_anglespawndata)

        
set_pev(idpev_fixangle1)
    }
}

public 
get_spawnpoints()
{
    static 
configdir[32]; get_configsdir(configdir31)
    static 
mapname[32]; get_mapname(mapname31)
    
    static 
csdmfile[64], line[64], data[10][6]
    
formatex(csdmfile63"%s/csdm/%s.spawns.cfg"configdirmapname)

    if(
file_exists(csdmfile))
    {
        static 
filefile fopen(csdmfile"rt")
        while(
file && !feof(file))
        {
            
fgets(fileline63)
            if(!
line[0] || str_count(line,' ') < 2) continue

            
parse(linedata[0], 5data[1], 5data[2], 5data[3], 5data[4], 5data[5], 5data[6], 5data[7], 5data[8], 5data[9], 5)

            
g_spawns[g_spawncount][0] = floatstr(data[0]), g_spawns[g_spawncount][1] = floatstr(data[1])
            
g_spawns[g_spawncount][2] = floatstr(data[2]), g_spawns[g_spawncount][3] = floatstr(data[3])
            
g_spawns[g_spawncount][4] = floatstr(data[4]), g_spawns[g_spawncount][5] = floatstr(data[5])
            
g_spawns[g_spawncount][6] = floatstr(data[7]), g_spawns[g_spawncount][7] = floatstr(data[8])
            
g_spawns[g_spawncount][8] = floatstr(data[9])
            
            if(
g_spawncount++ >= MAX_SPAWNS) break
        }
        if(
filefclose(file)
    }
}

public 
native_is_user_zombie(pluginparams)
{
    if(
params != 1) return 0
        
    
static indexindex get_param(1)
    if(!
index) return 0
    
    
return g_zombie[index] == true 0
}

public 
native_infect_user(pluginparams)
{
    if(
params != 1) return 0
        
    
static indexindex get_param(1)
    if(
is_user_alive(index) && allow_infection() && g_gamestarted)
    {
        
infect_user(index)
        return 
1
    
}
    return 
0
}

public 
native_is_user_firstzombie(pluginparams)
{
    if(
params != 1) return 0
        
    
static indexindex get_param(1)
    return 
index == g_zombieoftheround 0
}

public 
native_first_zombie(plugin)
    return 
g_zombieoftheround

public native_game_started(plugin)
    return 
g_gamestarted

stock bool
:fm_is_hull_vacant(const Float:origin[3], hull)
{
    static 
trtr 0engfunc(EngFunc_TraceHulloriginorigin0hull0tr)
    return (!
get_tr2(trTR_StartSolid) && !get_tr2(trTR_AllSolid) && get_tr2(trTR_InOpen)) ? true false
}

stock fm_set_kvd(entity, const key[], const value[], const classname[] = ""
{
    
set_kvd(0KV_ClassNameclassname), set_kvd(0KV_KeyNamekey)
    
set_kvd(0KV_Valuevalue), set_kvd(0KV_fHandled0)

    return 
dllfunc(DLLFunc_KeyValueentity0)
}

stock fm_strip_user_weapons(index
{
    static 
stripent
    
if(!pev_valid(stripent))
    {
        
stripent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"player_weaponstrip"))
        
dllfunc(DLLFunc_Spawnstripent), set_pev(stripentpev_solidSOLID_NOT)
    }
    
dllfunc(DLLFunc_Usestripentindex)
    
    return 
1
}

stock fm_set_entity_visibility(indexvisible 1)
    
set_pev(indexpev_effectsvisible == pev(indexpev_effects) & ~EF_NODRAW pev(indexpev_effects) | EF_NODRAW)

stock fm_find_ent_by_owner(index, const classname[], owner
{
    static 
entent index
    
while((ent engfunc(EngFunc_FindEntityByStringent"classname"classname)) && pev(entpev_owner) != owner) {}
    
    return 
ent
}

stock bacon_give_weapon(indexweapon[])
{
    if(!
equal(weapon,"weapon_"7)) return 0

    
static entent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringweapon))
    if(!
pev_valid(ent)) return 0
    
    set_pev
(entpev_spawnflagsSF_NORESPAWN)
    
dllfunc(DLLFunc_Spawnent)
   
    if(!
ExecuteHamB(Ham_AddPlayerItemindexent))
    {
        if(
pev_valid(ent)) set_pev(entpev_flagspev(entpev_flags) | FL_KILLME)
        return 
0
    
}
    
ExecuteHamB(Ham_Item_AttachToPlayerentindex)

    return 
1
}

stock cs_set_user_team2(index, {CsTeams,_}:teamupdate 1)
{
    
set_pdata_int(indexOFFSET_TEAM_:team)
    
set_pev(indexpev_team_:team)

    if(
update)
    {
        static 
_msg_teaminfo; if(!_msg_teaminfo_msg_teaminfo get_user_msgid("TeamInfo")
        static 
teaminfo[][] = { "UNASSIGNED""TERRORIST""CT""SPECTATOR" }
        
        
message_begin(MSG_BROADCAST_msg_teaminfo)
        
write_byte(index)
        
write_string(teaminfo[_:team])
        
message_end()
    }
    return 
1
}

stock cs_get_user_armor2(index, &CsArmorType:armortype)
{
    static 
armorvaluepev(indexpev_armorvaluearmorvalue)
    
armortype CsArmorType:get_pdata_int(indexOFFSET_ARMOR)
    
    return 
armorvalue
}

stock cs_set_user_armor2(indexarmorvalueCsArmorType:armortype)
{
    
set_pev(indexpev_armorvaluearmorvalue)
    
set_pdata_int(indexOFFSET_ARMOR_:armortype)
    
    return 
1
}

stock get_weapon_maxclip(weapon
{
    static 
ammo
    
switch(weapon)
    {
        case 
CSW_P228:              ammo 13
        
case CSW_GALI:              ammo 35
        
case CSW_USP:              ammo 12
        
case CSW_M249:              ammo 100
        
case CSW_M3:              ammo 8
        
case CSW_P90:              ammo 50
        
case CSW_SCOUTCSW_AWP:      ammo 10
        
case CSW_XM1014CSW_DEAGLE:     ammo 7
        
case CSW_UMP45CSW_FAMAS:     ammo 25
        
case CSW_FIVESEVENCSW_GLOCK18
        
CSW_G3SG1:             ammo 20
        
case CSW_KNIFECSW_FLASHBANG
        
CSW_SMOKEGRENADECSW_HEGRENADE
        
CSW_C4:                 ammo 0
        
case CSW_SG552CSW_AK47,
        
CSW_MP5NAVYCSW_M4A1
        
CSW_MAC10CSW_SG550
        
CSW_AUGCSW_ELITECSW_TMP:     ammo 30
        
default:             ammo 0
    
}
    return 
ammo
}

stock get_user_bpammo(indexweapon)
{
    static 
offset
    
switch(weapon)
    {
        case 
CSW_AWP:                offset OFFSET_AMMO_AWP
        
case CSW_SCOUTCSW_AK47CSW_G3SG1offset OFFSET_AMMO_SCOUT
        
case CSW_M249:               offset OFFSET_AMMO_M249
        
case CSW_FAMASCSW_M4A1CSW_AUG
        
CSW_SG550CSW_GALICSW_SG552:         offset OFFSET_AMMO_FAMAS
        
case CSW_M3CSW_XM1014:         offset OFFSET_AMMO_M3
        
case CSW_USPCSW_UMP45CSW_MAC10:  offset OFFSET_AMMO_USP
        
case CSW_FIVESEVENCSW_P90:         offset OFFSET_AMMO_FIVESEVEN
        
case CSW_DEAGLE:             offset OFFSET_AMMO_DEAGLE
        
case CSW_P228:                 offset OFFSET_AMMO_P228
        
case CSW_GLOCK18CSW_TMPCSW_ELITE
        
CSW_MP5NAVY:                 offset OFFSET_AMMO_GLOCK18
        
default:                 offset 0
    
}
    return 
offset get_pdata_int(indexoffset) : 0
}

stock set_user_bpammo(indexweaponamount)
{
    static 
offset
    
switch(weapon)
    {
        case 
CSW_AWP:                offset OFFSET_AMMO_AWP
        
case CSW_SCOUTCSW_AK47CSW_G3SG1offset OFFSET_AMMO_SCOUT
        
case CSW_M249:               offset OFFSET_AMMO_M249
        
case CSW_FAMASCSW_M4A1CSW_AUG
        
CSW_SG550CSW_GALICSW_SG552:         offset OFFSET_AMMO_FAMAS
        
case CSW_M3CSW_XM1014:         offset OFFSET_AMMO_M3
        
case CSW_USPCSW_UMP45CSW_MAC10:  offset OFFSET_AMMO_USP
        
case CSW_FIVESEVENCSW_P90:         offset OFFSET_AMMO_FIVESEVEN
        
case CSW_DEAGLE:             offset OFFSET_AMMO_DEAGLE
        
case CSW_P228:                 offset OFFSET_AMMO_P228
        
case CSW_GLOCK18CSW_TMPCSW_ELITE
        
CSW_MP5NAVY:                 offset OFFSET_AMMO_GLOCK18
        
default:                 offset 0
    
}
    
    if(
offsetset_pdata_int(indexoffsetamount)
    
    return 
1
}

stock set_user_nvg(index)
{
    static 
nvgnvg get_pdata_int(indexOFFSET_NVG)
    if(!(
nvg HAS_NVG))
    {
        
nvg |= HAS_NVG
        set_pdata_int
(indexOFFSET_NVGnvg)
    }
    return 
1
}

stock str_count(str[], searchchar)
{
    static 
maxlenmaxlen strlen(str)
    static 
icountcount 0
    
    
for(0<= maxleni++) if(str[i] == searchchar)
        
count++

    return 
count
}

stock reset_user_model(index
{
    
set_pev(indexpev_rendermodekRenderNormal)
    
set_pev(indexpev_renderamt0.0)

    if(
pev_valid(g_modelent[index]))
        
fm_set_entity_visibility(g_modelent[index], 0)
}

stock set_zombie_attibutes(index)
{
    if(!
is_user_alive(index)) return

    
cs_set_user_armor2(index0CS_ARMOR_NONE), set_pev(indexpev_body0), g_zombie[index] = true
    
    
if(!task_exists(TASKID_STRIPNGIVE index))
        
set_task(0.2"task_stripngive"TASKID_STRIPNGIVE index)
    
    if(
g_usingplayermodel)
    {
        if(!
pev_valid(g_modelent[index]))
        {
            static 
entent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
            if(
pev_valid(ent))
            {
                
engfunc(EngFunc_SetModelentg_zombie_model)
                
set_pev(entpev_classnameMODEL_CLASSNAME)
                
set_pev(entpev_movetypeMOVETYPE_FOLLOW)
                
set_pev(entpev_aimentindex)
                
set_pev(entpev_ownerindex)
                
                
g_modelent[index] = ent
            
}
        }
        else
        {
            
fm_set_entity_visibility(g_modelent[index], 1)
            
set_pev(g_modelent[index], pev_movetypeMOVETYPE_FOLLOW)
            
set_pev(g_modelent[index], pev_aimentindex)
        }
    }

    static 
Float:healthhealth float(get_pcvar_num(cvar_zombie_hp))
    static 
Float:bonusbonus float(get_pcvar_num(cvar_hpbonus))
    
set_pev(indexpev_healthg_zombieoftheround == index health bonus health)
    
    
set_user_nvg(index)
    if(
get_pcvar_num(cvar_autonvg)) engclient_cmd(index"nightvision")
    
    static 
effectseffects pev(indexpev_effects)
    if(
effects EF_DIMLIGHT)
    {
        static 
msg_flashlight
        
if(!msg_flashlightmsg_flashlight get_user_msgid("Flashlight")
        
        
message_begin(MSG_ONEmsg_flashlight_index)
        
write_byte(0)
        
write_byte(100)
        
message_end()
    
        
set_pev(indexpev_effectseffects & ~EF_DIMLIGHT)
    }
    
ExecuteForward(g_fwd_infect2g_fwd_resultindex)
}

stock bool:allow_infection()
{
    static 
indexcount[2], maxzombiescount[0] = 0count[1] = 0
    
for(index 1index <= g_maxplayersindex++)
    {
        if(
is_user_connected(index) && g_zombie[index]) count[0]++
        else if(
is_user_alive(index)) count[1]++
    }
    
    
maxzombies clamp(get_pcvar_num(cvar_maxzombies), 131)
    return (
count[0] < maxzombies && count[1] > 1) ? true false
}

stock randomly_pick_zombie()
{
    static 
indexplayers[2][32], data[4]
    
data[0] = 0data[1] = 0data[2] = 0data[3] = 0
    
    
for(index 1index <= g_maxplayersindex++)
    {
        if(!
is_user_alive(index)) continue
        
        if(
g_zombie[index]) data[0]++, players[0][data[2]++] = index
        
else             data[1]++, players[1][data[3]++] = index
    
}
    
    if(
data[0] > &&  data[1] < 1) return players[0][_random(data[2])]
    return (
data[0] < && data[1] > 1) ?  players[1][_random(data[3])] : 0
}

stock equipweapon(idweapon)
{
    if(!
is_user_alive(id)) return

    static 
weaponid
    
    
if(weapon EQUIP_PRI)
    {
        
fm_strip_user_weapons(id), bacon_give_weapon(id"weapon_knife")
        
bacon_give_weapon(idg_primweaponnames[g_weapons[id][0]])
        
        
weaponid get_weaponid(g_primweaponnames[g_weapons[id][0]])
        
set_user_bpammo(idweaponidMAX_AMMO)
    }
    
    if(
weapon EQUIP_SEC)
    {
        
bacon_give_weapon(idg_secweaponnames[g_weapons[id][1]])
            
        
weaponid get_weaponid(g_secweaponnames[g_weapons[id][1]])
        
set_user_bpammo(idweaponidMAX_AMMO)
    }
    
    if(
weapon EQUIP_GREN)
        
set_task(0.1"task_givenades"id TASKID_GIVENADES)


Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...