sm-zombiereloaded-3/src/zombiereloaded.sp

274 lines
6.1 KiB
SourcePawn
Raw Normal View History

2009-04-29 01:58:41 +02:00
/*
* ============================================================================
*
* Zombie:Reloaded
2009-04-29 01:58:41 +02:00
*
* File: zombiereloaded.sp
* Type: Base
* Description: Plugin's base file.
*
* Copyright (C) 2009 Greyscale, Richard Helgeby
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
2009-04-29 01:58:41 +02:00
*
* ============================================================================
2008-10-04 22:59:11 +02:00
*/
// Comment to use ZR Tools Extension, otherwise SDK Hooks Extension will be used.
#define USE_SDKHOOKS
2008-10-04 22:59:11 +02:00
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <clientprefs>
2008-10-04 22:59:11 +02:00
#include <cstrike>
#if defined USE_SDKHOOKS
#include <sdkhooks>
#define ACTION_CONTINUE Plugin_Continue
#define ACTION_HANDLED Plugin_Handled
#else
#include <zrtools>
#define ACTION_CONTINUE ZRTools_Continue
#define ACTION_HANDLED ZRTools_Handled
#endif
2008-10-04 22:59:11 +02:00
#define VERSION "3.0.0-b2"
2008-10-04 22:59:11 +02:00
// Comment this line to exclude version info command. Enable this if you have
// the repository and HG installed (Mercurial or TortoiseHG).
#define ADD_VERSION_INFO
// Header includes.
#include "zr/log.h"
#include "zr/models.h"
#if defined ADD_VERSION_INFO
#include "zr/hgversion.h"
#endif
2009-04-29 01:58:41 +02:00
// Core includes.
2008-10-04 22:59:11 +02:00
#include "zr/zombiereloaded"
#if defined ADD_VERSION_INFO
#include "zr/versioninfo"
#endif
#include "zr/translation"
#include "zr/cvars"
#include "zr/admintools"
#include "zr/log"
#include "zr/config"
#include "zr/steamidcache"
#include "zr/sayhooks"
2009-04-29 01:58:41 +02:00
#include "zr/tools"
#include "zr/menu"
#include "zr/cookies"
#include "zr/paramtools"
#include "zr/paramparser"
#include "zr/shoppinglist"
#include "zr/downloads"
#include "zr/overlays"
#include "zr/playerclasses/playerclasses"
#include "zr/models"
#include "zr/weapons/weapons"
#include "zr/hitgroups"
#include "zr/roundstart"
#include "zr/roundend"
#include "zr/infect"
#include "zr/damage"
2009-04-29 01:58:41 +02:00
#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/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"
#include "zr/jumpboost"
2009-04-29 01:58:41 +02:00
#include "zr/zspawn"
#include "zr/ztele"
#include "zr/zhp"
#include "zr/zcookies"
2009-04-29 01:58:41 +02:00
#include "zr/jumpboost"
#include "zr/volfeatures/volfeatures"
#include "zr/debugtools"
2009-04-29 01:58:41 +02:00
/**
* Record plugin info.
2009-04-29 01:58:41 +02:00
*/
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,
url = "http://www.zombiereloaded.com"
2008-10-04 22:59:11 +02:00
};
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()
{
// Forward event to modules.
LogInit(); // Doesn't depend on CVARs.
TranslationInit();
CvarsInit();
2009-04-29 01:58:41 +02:00
ToolsInit();
CookiesInit();
CommandsInit();
WeaponsInit();
EventInit();
2008-10-04 22:59:11 +02:00
}
/**
* All plugins have finished loading.
*/
public OnAllPluginsLoaded()
{
// Forward event to modules.
WeaponsOnAllPluginsLoaded();
}
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.
ClassOnMapStart();
OverlaysOnMapStart();
RoundEndOnMapStart();
InfectOnMapStart();
SEffectsOnMapStart();
2009-05-06 03:04:55 +02:00
ZSpawnOnMapStart();
VolInit();
}
2009-04-29 01:58:41 +02:00
/**
* The map is ending.
*/
public OnMapEnd()
{
// Forward event to modules.
VolOnMapEnd();
VEffectsOnMapEnd();
}
/**
* Main configs were just executed.
*/
public OnAutoConfigsBuffered()
{
// Load map configurations.
ConfigLoad();
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. (OnConfigsExecuted)
ModelsLoad();
DownloadsLoad();
WeaponsLoad();
HitgroupsLoad();
InfectLoad();
DamageLoad();
VEffectsLoad();
SEffectsLoad();
AntiStickLoad();
ClassLoad();
VolLoad();
// Forward event to modules. (OnModulesLoaded)
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);
AntiStickClientInit(client);
SpawnProtectClientInit(client);
RespawnClientInit(client);
ZTeleClientInit(client);
ZHPClientInit(client);
2008-10-04 22:59:11 +02:00
}
/**
* Client is authorized and fully in-game.
*
* @param client Client index.
*/
public OnClientPostAdminCheck(client)
{
// Forward authorized event to modules that depend on client admin info.
ClassOnClientAuthorized(client);
}
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);
AntiStickOnClientDisconnect(client);
2009-04-29 01:58:41 +02:00
ZSpawnOnClientDisconnect(client);
VolOnPlayerDisconnect(client);
}