2008-10-04 22:59:11 +02:00
/ * *
* = = = = = = = = = = = = = = = = = = = =
* Zombie : Reloaded
* File : zombiereloaded . sp
* Author : Greyscale
* = = = = = = = = = = = = = = = = = = = =
* /
# pragma semicolon 1
# include <sourcemod>
# include <sdktools>
# include <cstrike>
# include <hacks>
# undef REQUIRE_PLUGIN
# include <market>
2009-04-01 19:10:10 +02:00
# define VERSION "3.0-dev"
2008-10-04 22:59:11 +02:00
# include "zr/zombiereloaded"
# include "zr/global"
# include "zr/cvars"
# include "zr/translation"
# include "zr/offsets"
# include "zr/ambience"
# include "zr/models"
# include "zr/overlays"
2009-04-16 05:30:26 +02:00
// Class system
2009-04-06 03:20:13 +02:00
# include "zr/playerclasses/playerclasses"
2009-04-16 05:30:26 +02:00
// Antistick
2009-04-05 23:20:35 +02:00
# include "zr/antistick"
2009-04-16 05:30:26 +02:00
2009-01-19 22:45:58 +01:00
# include "zr/anticamp"
2008-12-20 20:46:05 +01:00
# include "zr/teleport"
2008-10-04 22:59:11 +02:00
# include "zr/zombie"
# include "zr/menu"
# include "zr/sayhooks"
2009-04-10 01:08:51 +02:00
// Weapons
2009-04-12 08:04:00 +02:00
# include "zr/weapons/weapons"
2009-04-10 01:08:51 +02:00
2009-04-16 22:21:32 +02:00
// Sound effects
# include "zr/soundeffects/soundeffects"
2009-04-15 03:24:02 +02:00
// Hitgroups
# include "zr/hitgroups"
2009-04-14 22:05:20 +02:00
// Knockback
# include "zr/knockback"
2009-04-15 11:27:03 +02:00
// Spawn protect
# include "zr/spawnprotect"
2009-04-16 05:30:26 +02:00
// Respawn
# include "zr/respawn"
2009-04-16 01:18:08 +02:00
// ZHP
# include "zr/zhp"
2009-04-12 08:04:00 +02:00
# include "zr/zadmin"
2008-10-04 22:59:11 +02:00
# include "zr/damagecontrol"
# include "zr/commands"
# include "zr/event"
public Plugin : myinfo =
{
name = " Zombie:Reloaded " ,
author = " Greyscale " ,
description = " Infection/survival style gameplay " ,
version = VERSION ,
url = " "
} ;
public bool : AskPluginLoad ( Handle : myself , bool : late , String : error [ ] , err_max )
{
CreateGlobals ( ) ;
return true ;
}
public OnPluginStart ( )
{
LoadTranslations ( " common.phrases.txt " ) ;
LoadTranslations ( " zombiereloaded.phrases.txt " ) ;
// ======================================================================
ZR_PrintToServer ( " Plugin loading " ) ;
// ======================================================================
HookEvents ( ) ;
HookChatCmds ( ) ;
CreateCvars ( ) ;
HookCvars ( ) ;
CreateCommands ( ) ;
HookCommands ( ) ;
FindOffsets ( ) ;
SetupGameData ( ) ;
2009-04-13 20:33:13 +02:00
// Weapons
WeaponsInit ( ) ;
2008-10-04 22:59:11 +02:00
InitDmgControl ( ) ;
// ======================================================================
market = LibraryExists ( " market " ) ;
// ======================================================================
CreateConVar ( " gs_zombiereloaded_version " , VERSION , " [ZR] Current version of this plugin " , FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_UNLOGGED | FCVAR_DONTRECORD | FCVAR_REPLICATED | FCVAR_NOTIFY ) ;
2008-10-04 23:02:25 +02:00
CreateConVar ( " zombie_version " , VERSION , " Zombie:Reloaded Version " , FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_UNLOGGED | FCVAR_DONTRECORD | FCVAR_REPLICATED | FCVAR_NOTIFY ) ;
CreateConVar ( " zombie_enabled " , " 1 " , " Not synced with zr_enable " , FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_UNLOGGED | FCVAR_DONTRECORD | FCVAR_REPLICATED | FCVAR_NOTIFY ) ;
2008-10-04 22:59:11 +02:00
// ======================================================================
ZR_PrintToServer ( " Plugin loaded " ) ;
}
public OnLibraryRemoved ( const String : name [ ] )
{
if ( StrEqual ( name , " market " ) )
{
market = false ;
}
}
public OnLibraryAdded ( const String : name [ ] )
{
if ( StrEqual ( name , " market " ) )
{
market = true ;
}
}
public OnMapStart ( )
{
MapChangeCleanup ( ) ;
LoadModelData ( ) ;
LoadDownloadData ( ) ;
2008-10-12 18:56:51 +02:00
2009-04-13 04:35:11 +02:00
// Forward event to modules.
2009-04-14 23:16:31 +02:00
ClassLoad ( ) ;
2009-04-15 03:24:02 +02:00
WeaponsLoad ( ) ;
HitgroupsLoad ( ) ;
2009-01-19 22:45:58 +01:00
Anticamp_Startup ( ) ;
}
public OnMapEnd ( )
{
Anticamp_Disable ( ) ;
2008-10-04 22:59:11 +02:00
}
public OnConfigsExecuted ( )
{
decl String : mapconfig [ PLATFORM_MAX_PATH ] ;
GetCurrentMap ( mapconfig , sizeof ( mapconfig ) ) ;
Format ( mapconfig , sizeof ( mapconfig ) , " sourcemod/zombiereloaded/%s.cfg " , mapconfig ) ;
decl String : path [ PLATFORM_MAX_PATH ] ;
Format ( path , sizeof ( path ) , " cfg/%s " , mapconfig ) ;
if ( FileExists ( path ) )
{
ServerCommand ( " exec %s " , mapconfig ) ;
2009-04-14 22:05:20 +02:00
2009-04-13 04:37:17 +02:00
if ( LogFlagCheck ( LOG_CORE_EVENTS ) )
{
LogMessage ( " Executed map config file: %s " , mapconfig ) ;
2009-04-13 04:35:11 +02:00
}
2008-10-04 22:59:11 +02:00
}
2009-04-13 04:35:11 +02:00
FindMapSky ( ) ;
LoadAmbienceData ( ) ;
2008-10-04 22:59:11 +02:00
}
public OnClientPutInServer ( client )
{
gBlockMotherInfect [ client ] = false ;
2009-04-13 04:35:11 +02:00
// Forward event to modules.
ClassClientInit ( client ) ;
2009-04-16 22:21:32 +02:00
ZombieSoundsClientInit ( client ) ;
2009-04-16 01:18:08 +02:00
WeaponsClientInit ( client ) ;
SpawnProtectClientInit ( client ) ;
2009-04-16 05:30:26 +02:00
RespawnClientInit ( client ) ;
2009-04-16 01:18:08 +02:00
ZHPClientInit ( client ) ;
2009-04-13 04:35:11 +02:00
if ( ! IsFakeClient ( client ) ) AmbienceStart ( client ) ;
2009-04-09 06:49:15 +02:00
2008-10-04 22:59:11 +02:00
ClientHookAttack ( client ) ;
FindClientDXLevel ( client ) ;
for ( new x = 0 ; x < MAXTIMERS ; x + + )
{
tHandles [ client ] [ x ] = INVALID_HANDLE ;
}
2008-10-29 22:02:46 +01:00
RefreshList ( ) ;
2008-10-04 22:59:11 +02:00
}
public OnClientDisconnect ( client )
{
ClientUnHookAttack ( client ) ;
2009-04-11 01:56:22 +02:00
2009-04-12 08:04:00 +02:00
PlayerLeft ( client ) ;
2009-04-13 04:35:11 +02:00
// Forward event to modules.
ClassOnClientDisconnect ( client ) ;
2009-04-16 01:18:08 +02:00
WeaponsOnClientDisconnect ( client ) ;
2008-12-20 20:46:05 +01:00
ZTeleResetClient ( client ) ;
2009-02-15 22:25:17 +01:00
AmbienceStop ( client ) ;
2008-11-12 16:01:50 +01:00
2008-10-04 22:59:11 +02:00
for ( new x = 0 ; x < MAXTIMERS ; x + + )
{
if ( tHandles [ client ] [ x ] ! = INVALID_HANDLE )
{
2008-10-29 22:02:46 +01:00
KillTimer ( tHandles [ client ] [ x ] ) ;
2008-10-04 22:59:11 +02:00
tHandles [ client ] [ x ] = INVALID_HANDLE ;
}
}
2008-10-29 22:02:46 +01:00
RefreshList ( ) ;
2008-10-04 22:59:11 +02:00
}
MapChangeCleanup ( )
{
tRound = INVALID_HANDLE ;
tInfect = INVALID_HANDLE ;
2009-02-15 22:25:17 +01:00
AmbienceStopAll ( ) ;
2009-04-05 23:20:35 +02:00
AntiStickReset ( ) ;
2008-10-29 22:02:46 +01:00
2009-04-16 03:57:46 +02:00
// x = client index.
for ( new x = 1 ; x < = MaxClients ; x + + )
2008-10-29 22:02:46 +01:00
{
2009-04-16 03:57:46 +02:00
for ( new y = 0 ; y < MAXTIMERS ; y + + )
2008-10-29 22:02:46 +01:00
{
2009-04-16 03:57:46 +02:00
if ( tHandles [ x ] [ y ] ! = INVALID_HANDLE )
2008-10-29 22:02:46 +01:00
{
2009-04-16 03:57:46 +02:00
tHandles [ x ] [ y ] = INVALID_HANDLE ;
2008-10-29 22:02:46 +01:00
}
}
}
2008-10-04 22:59:11 +02:00
}
ZREnd ( )
{
TerminateRound ( 3.0 , Game_Commencing ) ;
UnhookCvars ( ) ;
UnhookEvents ( ) ;
2009-04-13 04:35:11 +02:00
// TODO: Disable all modules! Teleport, ambience, overlays, antistick, etc.
2008-10-04 22:59:11 +02:00
new maxplayers = GetMaxClients ( ) ;
for ( new x = 1 ; x < = maxplayers ; x + + )
{
2009-04-16 03:57:46 +02:00
if ( ! IsClientInGame ( x ) )
2008-10-04 22:59:11 +02:00
{
continue ;
}
for ( new y = 0 ; y < MAXTIMERS ; y + + )
{
if ( tHandles [ x ] [ y ] ! = INVALID_HANDLE )
{
2008-10-29 22:02:46 +01:00
KillTimer ( tHandles [ x ] [ y ] ) ;
2008-10-04 22:59:11 +02:00
tHandles [ x ] [ y ] = INVALID_HANDLE ;
}
}
}
2009-04-09 06:49:15 +02:00
}