sm-zombiereloaded-3/src/zombiereloaded.sp

248 lines
5.1 KiB
SourcePawn
Raw Normal View History

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>
#define VERSION "3.0-dev"
2008-10-04 22:59:11 +02:00
// Core include
2008-10-04 22:59:11 +02:00
#include "zr/zombiereloaded"
// External api (not done)
//#include "zr/global"
// Log (core)
#include "zr/log"
// Cvars (core)
#include "zr/cvars"
// Translations (core)
2008-10-04 22:59:11 +02:00
#include "zr/translation"
// Offsets (core)
2008-10-04 22:59:11 +02:00
#include "zr/offsets"
// Models (core)
2008-10-04 22:59:11 +02:00
#include "zr/models"
// Class System (core)
#include "zr/playerclasses/playerclasses"
// Weapons (core)
#include "zr/weapons/weapons"
// Hitgroups (core)
#include "zr/hitgroups"
// Round End (core)
#include "zr/roundend"
// Infect (core)
#include "zr/infect"
// Damage (core)
#include "zr/damage"
// Account (module)
#include "zr/account"
// Visual Effects (module)
#include "zr/visualeffects"
// Sound Effects (module)
#include "zr/soundeffects/soundeffects"
// Antistick (module)
#include "zr/antistick"
// Knockback (module)
#include "zr/knockback"
// Spawn Protect (module)
2009-04-15 11:27:03 +02:00
#include "zr/spawnprotect"
// Respawn (module)
#include "zr/respawn"
// Napalm (module)
#include "zr/napalm"
// ZHP (module)
#include "zr/zhp"
#include "zr/anticamp"
#include "zr/teleport"
#include "zr/zombie"
#include "zr/menu"
#include "zr/sayhooks"
#include "zr/zadmin"
2008-10-04 22:59:11 +02:00
#include "zr/commands"
// Event
2008-10-04 22:59:11 +02:00
#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)
{
// 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");
// ======================================================================
// Log
LogInit();
// Cvars
CvarsInit();
// TODO: Be modulized/recoded.
2008-10-04 22:59:11 +02:00
HookChatCmds();
CreateCommands();
HookCommands();
FindOffsets();
SetupGameData();
// Weapons
WeaponsInit();
// Damage
DamageInit();
2008-10-04 22:59:11 +02:00
// Event
EventInit();
2008-10-04 22:59:11 +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);
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"))
{
g_bMarket = false;
2008-10-04 22:59:11 +02:00
}
}
public OnLibraryAdded(const String:name[])
{
if (StrEqual(name, "market"))
{
g_bMarket = true;
2008-10-04 22:59:11 +02:00
}
}
public OnMapStart()
{
LoadModelData();
LoadDownloadData();
// Forward event to modules.
ClassLoad();
RoundEndOnMapStart();
InfectOnMapStart();
SEffectsOnMapStart();
AntiStickOnMapStart();
Anticamp_Startup();
}
public OnMapEnd()
{
// Forward event to modules.
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);
if (LogCheckFlag(LOG_CORE_EVENTS))
2009-04-13 04:37:17 +02:00
{
LogMessageFormatted(-1, "", "", "Executed map config file: %s.", LOG_FORMAT_TYPE_SIMPLE, mapconfig);
}
2008-10-04 22:59:11 +02:00
}
// Forward event to modules.
WeaponsLoad();
HitgroupsLoad();
InfectLoad();
VEffectsLoad();
SEffectsLoad();
2008-10-04 22:59:11 +02:00
}
public OnClientPutInServer(client)
{
// Forward event to modules.
ClassClientInit(client);
WeaponsClientInit(client);
RoundEndClientInit(client);
InfectClientInit(client);
DamageClientInit(client);
SEffectsClientInit(client);
SpawnProtectClientInit(client);
RespawnClientInit(client);
ZHPClientInit(client);
2008-10-04 22:59:11 +02:00
}
public OnClientDisconnect(client)
{
// Forward event to modules.
ClassOnClientDisconnect(client);
WeaponsOnClientDisconnect(client);
InfectOnClientDisconnect(client);
DamageOnClientDisconnect(client);
ZTeleResetClient(client);
}