sm-zombiereloaded-3/src/zombiereloaded.sp

236 lines
4.8 KiB
SourcePawn
Raw Normal View History

2009-04-29 01:58:41 +02:00
/*
* ============================================================================
*
2008-10-04 22:59:11 +02:00
* Zombie:Reloaded
2009-04-29 01:58:41 +02:00
*
* File: zombiereloaded.sp
* Type: Base
* Description: Plugin's base file.
2009-04-29 01:58:41 +02:00
*
* ============================================================================
2008-10-04 22:59:11 +02:00
*/
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <zrtools>
2008-10-04 22:59:11 +02:00
#undef REQUIRE_PLUGIN
#include <market>
#define VERSION "3.0-dev"
2008-10-04 22:59:11 +02:00
2009-04-29 01:58:41 +02:00
// Core includes.
2008-10-04 22:59:11 +02:00
#include "zr/zombiereloaded"
#include "zr/log"
#include "zr/cvars"
#include "zr/config"
#include "zr/serial"
2008-10-04 22:59:11 +02:00
#include "zr/translation"
#include "zr/sayhooks"
2009-04-29 01:58:41 +02:00
#include "zr/tools"
2008-10-04 22:59:11 +02:00
#include "zr/models"
#include "zr/overlays"
#include "zr/playerclasses/playerclasses"
#include "zr/weapons/weapons"
#include "zr/hitgroups"
#include "zr/roundend"
#include "zr/infect"
#include "zr/damage"
2009-04-29 01:58:41 +02:00
#include "zr/menu"
#include "zr/event"
#include "zr/zadmin"
#include "zr/commands"
//#include "zr/global"
2009-04-29 01:58:41 +02:00
// Modules
#include "zr/account"
#include "zr/visualeffects"
#include "zr/soundeffects/soundeffects"
#include "zr/antistick"
#include "zr/knockback"
2009-04-15 11:27:03 +02:00
#include "zr/spawnprotect"
#include "zr/respawn"
#include "zr/napalm"
2009-04-29 01:58:41 +02:00
#include "zr/zspawn"
#include "zr/ztele"
#include "zr/zhp"
2009-04-29 01:58:41 +02:00
#include "zr/jumpboost"
#include "zr/anticamp"
2009-04-29 01:58:41 +02:00
// Almost replaced! :)
#include "zr/zombie"
2008-10-04 22:59:11 +02:00
2009-04-29 01:58:41 +02:00
/**
* Tell SM ZR's info.
*/
2008-10-04 22:59:11 +02:00
public Plugin:myinfo =
{
2009-04-29 01:58:41 +02:00
name = "Zombie:Reloaded",
author = "Greyscale | Richard Helgeby",
2009-04-29 01:58:41 +02:00
description = "Infection/survival style gameplay",
version = VERSION,
2008-10-04 22:59:11 +02:00
url = ""
};
2009-04-29 01:58:41 +02:00
/**
* Called before plugin is loaded.
*
* @param myself The plugin handle.
* @param late True if the plugin was loaded after map change, false on map start.
* @param error Error message if load failed.
* @param err_max Max length of the error message.
*/
2008-10-04 22:59:11 +02:00
public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
{
2009-04-29 01:58:41 +02:00
// TODO: EXTERNAL API
2008-10-04 22:59:11 +02:00
2009-04-29 01:58:41 +02:00
// Let plugin load.
2008-10-04 22:59:11 +02:00
return true;
}
2009-04-29 01:58:41 +02:00
/**
* Plugin is loading.
*/
2008-10-04 22:59:11 +02:00
public OnPluginStart()
{
2009-04-29 01:58:41 +02:00
// Load translations phrases used by plugin.
2008-10-04 22:59:11 +02:00
LoadTranslations("common.phrases.txt");
LoadTranslations("zombiereloaded.phrases.txt");
// Log
LogInit();
// Cvars
CvarsInit();
2009-04-29 01:58:41 +02:00
// Tools
ToolsInit();
// Commands
CommandsInit();
// Weapons
WeaponsInit();
2009-04-29 01:58:41 +02:00
// Say Hooks
SayHooksInit();
// Event
EventInit();
2009-04-29 01:58:41 +02:00
// Set market variable to true if market is installed.
g_bMarket = LibraryExists("market");
2008-10-04 22:59:11 +02:00
2009-04-29 01:58:41 +02:00
// Create public cvar for tracking.
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);
}
2009-04-29 01:58:41 +02:00
/**
* Library is being removed.
*
* @param name The name of the library.
*/
2008-10-04 22:59:11 +02:00
public OnLibraryRemoved(const String:name[])
{
2009-04-29 01:58:41 +02:00
// If market is being removed, then set variable to false.
if (StrEqual(name, "market", false))
{
g_bMarket = false;
}
2008-10-04 22:59:11 +02:00
}
2009-04-29 01:58:41 +02:00
/**
* Library is being added.
*
* @param name The name of the library.
*/
2008-10-04 22:59:11 +02:00
public OnLibraryAdded(const String:name[])
{
2009-04-29 01:58:41 +02:00
// If market is being added, then set variable to true.
if (StrEqual(name, "market", false))
{
g_bMarket = true;
}
2008-10-04 22:59:11 +02:00
}
2009-04-29 01:58:41 +02:00
/**
* The map is starting.
*/
2008-10-04 22:59:11 +02:00
public OnMapStart()
{
// Forward event to modules.
SerialOnMapStart();
OverlaysOnMapStart();
RoundEndOnMapStart();
InfectOnMapStart();
SEffectsOnMapStart();
AntiStickOnMapStart();
2009-05-06 03:04:55 +02:00
ZSpawnOnMapStart();
Anticamp_Startup();
}
2009-04-29 01:58:41 +02:00
/**
* The map is ending.
*/
public OnMapEnd()
{
// Forward event to modules.
Anticamp_Disable();
2008-10-04 22:59:11 +02:00
}
2009-04-29 01:58:41 +02:00
/**
* Configs just finished getting executed.
*/
2008-10-04 22:59:11 +02:00
public OnConfigsExecuted()
{
// Forward event to modules.
ConfigLoad();
ModelsLoad();
WeaponsLoad();
HitgroupsLoad();
InfectLoad();
VEffectsLoad();
SEffectsLoad();
ClassLoad();
ConfigOnModulesLoaded();
ClassOnModulesLoaded();
2008-10-04 22:59:11 +02:00
}
2009-04-29 01:58:41 +02:00
/**
* Client is joining the server.
*
* @param client The client index.
*/
2008-10-04 22:59:11 +02:00
public OnClientPutInServer(client)
{
// Forward event to modules.
ClassClientInit(client);
OverlaysClientInit(client);
WeaponsClientInit(client);
InfectClientInit(client);
DamageClientInit(client);
SEffectsClientInit(client);
SpawnProtectClientInit(client);
RespawnClientInit(client);
ZTeleClientInit(client);
ZHPClientInit(client);
2008-10-04 22:59:11 +02:00
}
2009-04-29 01:58:41 +02:00
/**
* Client is leaving the server.
*
* @param client The client index.
*/
2008-10-04 22:59:11 +02:00
public OnClientDisconnect(client)
{
// Forward event to modules.
ClassOnClientDisconnect(client);
WeaponsOnClientDisconnect(client);
InfectOnClientDisconnect(client);
DamageOnClientDisconnect(client);
2009-04-29 01:58:41 +02:00
ZSpawnOnClientDisconnect(client);
}