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
2009-04-20 05:43:20 +02:00
// Core include
2008-10-04 22:59:11 +02:00
# include "zr/zombiereloaded"
2009-04-18 01:44:41 +02:00
// External api (not done)
//#include "zr/global"
// Cvars (core)
2008-10-04 22:59:11 +02:00
# include "zr/cvars"
2009-04-18 01:44:41 +02:00
2009-04-20 05:43:20 +02:00
// Log (core)
# include "zr/log"
2009-04-20 02:56:26 +02:00
2009-04-18 01:44:41 +02:00
// Translations (core)
2008-10-04 22:59:11 +02:00
# include "zr/translation"
2009-04-18 01:44:41 +02:00
// Offsets (core)
2008-10-04 22:59:11 +02:00
# include "zr/offsets"
2009-04-18 01:44:41 +02:00
// Models (core)
2008-10-04 22:59:11 +02:00
# include "zr/models"
2009-04-16 05:30:26 +02:00
2009-04-20 02:56:26 +02:00
// Class System (core)
# include "zr/playerclasses/playerclasses"
// Round End (core)
2009-04-18 01:44:41 +02:00
# include "zr/roundend"
2009-04-19 19:54:21 +02:00
// Damage (core)
# include "zr/damage"
2009-04-20 02:56:26 +02:00
// Weapons (core)
2009-04-12 08:04:00 +02:00
# include "zr/weapons/weapons"
2009-04-10 01:08:51 +02:00
2009-04-20 02:56:26 +02:00
// Hitgroups (core)
# include "zr/hitgroups"
// Sound Effects (module)
2009-04-16 22:21:32 +02:00
# include "zr/soundeffects/soundeffects"
2009-04-18 01:44:41 +02:00
// Antistick (module)
2009-04-17 01:09:52 +02:00
# include "zr/antistick"
2009-04-18 01:44:41 +02:00
// Knockback (module)
2009-04-14 22:05:20 +02:00
# include "zr/knockback"
2009-04-20 02:56:26 +02:00
// Spawn Protect (module)
2009-04-15 11:27:03 +02:00
# include "zr/spawnprotect"
2009-04-18 01:44:41 +02:00
// Respawn (module)
2009-04-16 05:30:26 +02:00
# include "zr/respawn"
2009-04-18 01:44:41 +02:00
// Napalm (module)
2009-04-17 10:20:04 +02:00
# include "zr/napalm"
2009-04-18 01:44:41 +02:00
// ZHP (module)
2009-04-16 01:18:08 +02:00
# include "zr/zhp"
2009-04-20 02:56:26 +02:00
# include "zr/anticamp"
# include "zr/teleport"
# include "zr/zombie"
# include "zr/menu"
# include "zr/sayhooks"
2009-04-12 08:04:00 +02:00
# include "zr/zadmin"
2008-10-04 22:59:11 +02:00
# 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 )
{
2009-04-18 01:44:41 +02:00
// Todo: External API
//CreateGlobals();
2008-10-04 22:59:11 +02:00
return true ;
}
public OnPluginStart ( )
{
LoadTranslations ( " common.phrases.txt " ) ;
LoadTranslations ( " zombiereloaded.phrases.txt " ) ;
// ======================================================================
ZR_PrintToServer ( " Plugin loading " ) ;
// ======================================================================
2009-04-20 02:56:26 +02:00
// Cvars
CvarsInit ( ) ;
CvarsHook ( ) ;
// TODO: Be modulized/recoded.
2008-10-04 22:59:11 +02:00
HookEvents ( ) ;
HookChatCmds ( ) ;
CreateCommands ( ) ;
HookCommands ( ) ;
FindOffsets ( ) ;
SetupGameData ( ) ;
2009-04-13 20:33:13 +02:00
// Weapons
WeaponsInit ( ) ;
2009-04-19 19:54:21 +02:00
// Damage
DamageInit ( ) ;
2008-10-04 22:59:11 +02:00
// ======================================================================
2009-04-17 12:16:44 +02:00
g_bMarket = LibraryExists ( " market " ) ;
2008-10-04 22:59:11 +02:00
// ======================================================================
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 " ) )
{
2009-04-17 12:16:44 +02:00
g_bMarket = false ;
2008-10-04 22:59:11 +02:00
}
}
public OnLibraryAdded ( const String : name [ ] )
{
if ( StrEqual ( name , " market " ) )
{
2009-04-17 12:16:44 +02:00
g_bMarket = true ;
2008-10-04 22:59:11 +02:00
}
}
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-20 02:56:26 +02:00
RoundEndOnMapStart ( ) ;
2009-04-15 03:24:02 +02:00
WeaponsLoad ( ) ;
HitgroupsLoad ( ) ;
2009-04-20 02:56:26 +02:00
SEffectsOnMapStart ( ) ;
2009-04-21 02:03:35 +02:00
AntiStickOnMapStart ( ) ;
2009-01-19 22:45:58 +01:00
Anticamp_Startup ( ) ;
}
public OnMapEnd ( )
{
2009-04-17 01:09:52 +02:00
// Forward event to modules.
2009-01-19 22:45:58 +01:00
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-20 05:43:20 +02:00
if ( LogCheckFlag ( LOG_CORE_EVENTS ) )
2009-04-13 04:37:17 +02:00
{
2009-04-20 05:43:20 +02:00
LogMessageFormatted ( - 1 , " " , " " , " Executed map config file: %s. " , LOG_FORMAT_TYPE_SIMPLE , 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 ( ) ;
2009-04-17 01:09:52 +02:00
// Forward event to modules.
SEffectsLoad ( ) ;
2008-10-04 22:59:11 +02:00
}
public OnClientPutInServer ( client )
{
2009-04-17 12:16:44 +02:00
bMotherInfectImmune [ client ] = false ;
2008-10-04 22:59:11 +02:00
2009-04-13 04:35:11 +02:00
// Forward event to modules.
2009-04-20 02:56:26 +02:00
ClassClientInit ( client ) ;
2009-04-19 19:54:21 +02:00
RoundEndClientInit ( client ) ;
DamageClientInit ( client ) ;
2009-04-17 01:09:52 +02:00
SEffectsClientInit ( 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 ) ;
2008-10-04 22:59:11 +02:00
}
public OnClientDisconnect ( client )
{
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-20 02:56:26 +02:00
DamageOnClientDisconnect ( client ) ;
2009-04-16 01:18:08 +02:00
WeaponsOnClientDisconnect ( client ) ;
2008-12-20 20:46:05 +01:00
ZTeleResetClient ( client ) ;
2008-10-04 22:59:11 +02:00
}
MapChangeCleanup ( )
{
tInfect = INVALID_HANDLE ;
}
2009-04-18 01:44:41 +02:00
/ * ZREnd ( )
2008-10-04 22:59:11 +02:00
{
TerminateRound ( 3.0 , Game_Commencing ) ;
2009-04-20 02:56:26 +02:00
CvarsHook ( ) ;
CvarsUnhook ( ) ;
2008-10-04 22:59:11 +02:00
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-18 01:44:41 +02:00
} * /