2009-04-29 01:58:41 +02:00
|
|
|
/*
|
|
|
|
* ============================================================================
|
|
|
|
*
|
2009-07-05 08:49:23 +02:00
|
|
|
* Zombie:Reloaded
|
2009-04-29 01:58:41 +02:00
|
|
|
*
|
2009-06-12 05:51:26 +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
|
|
|
*/
|
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// Comment to use ZR Tools Extension, otherwise SDK Hooks Extension will be used.
|
2010-01-25 11:07:39 +01:00
|
|
|
#define USE_SDKHOOKS
|
2009-11-04 21:37:26 +01:00
|
|
|
|
2008-10-04 22:59:11 +02:00
|
|
|
#pragma semicolon 1
|
|
|
|
#include <sourcemod>
|
|
|
|
#include <sdktools>
|
2009-06-20 09:15:43 +02:00
|
|
|
#include <clientprefs>
|
2008-10-04 22:59:11 +02:00
|
|
|
#include <cstrike>
|
2009-11-04 21:37:26 +01:00
|
|
|
|
|
|
|
#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
|
|
|
|
2009-12-11 17:30:01 +01:00
|
|
|
#define VERSION "3.0.0-b2"
|
2008-10-04 22:59:11 +02:00
|
|
|
|
2009-11-04 21:37:26 +01:00
|
|
|
// Comment this line to exclude version info command. Enable this if you have
|
|
|
|
// the repository and HG installed (Mercurial or TortoiseHG).
|
2009-08-27 20:46:44 +02:00
|
|
|
#define ADD_VERSION_INFO
|
2009-08-23 06:19:15 +02:00
|
|
|
|
2009-06-01 23:29:26 +02:00
|
|
|
// Header includes.
|
|
|
|
#include "zr/log.h"
|
2009-11-17 08:47:39 +01:00
|
|
|
#include "zr/models.h"
|
2009-06-01 23:29:26 +02:00
|
|
|
|
2009-08-23 06:19:15 +02:00
|
|
|
#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"
|
2009-08-23 06:19:15 +02:00
|
|
|
|
|
|
|
#if defined ADD_VERSION_INFO
|
|
|
|
#include "zr/versioninfo"
|
|
|
|
#endif
|
|
|
|
|
2009-05-14 09:32:01 +02:00
|
|
|
#include "zr/translation"
|
2009-04-27 04:00:38 +02:00
|
|
|
#include "zr/cvars"
|
2009-08-11 03:29:22 +02:00
|
|
|
#include "zr/admintools"
|
2009-05-14 09:32:01 +02:00
|
|
|
#include "zr/log"
|
2009-04-30 07:36:57 +02:00
|
|
|
#include "zr/config"
|
2009-06-21 07:24:31 +02:00
|
|
|
#include "zr/steamidcache"
|
2009-05-08 04:57:21 +02:00
|
|
|
#include "zr/sayhooks"
|
2009-04-29 01:58:41 +02:00
|
|
|
#include "zr/tools"
|
2009-07-27 22:25:23 +02:00
|
|
|
#include "zr/menu"
|
2009-06-20 09:15:43 +02:00
|
|
|
#include "zr/cookies"
|
2009-05-30 04:17:01 +02:00
|
|
|
#include "zr/paramtools"
|
2009-08-04 03:41:16 +02:00
|
|
|
#include "zr/paramparser"
|
2009-08-30 20:47:01 +02:00
|
|
|
#include "zr/shoppinglist"
|
2009-05-18 06:26:13 +02:00
|
|
|
#include "zr/downloads"
|
2009-05-14 02:28:26 +02:00
|
|
|
#include "zr/overlays"
|
2009-04-20 02:56:26 +02:00
|
|
|
#include "zr/playerclasses/playerclasses"
|
2009-11-17 08:47:39 +01:00
|
|
|
#include "zr/models"
|
2009-04-22 04:53:19 +02:00
|
|
|
#include "zr/weapons/weapons"
|
2009-04-23 06:39:11 +02:00
|
|
|
#include "zr/hitgroups"
|
2009-05-20 06:24:43 +02:00
|
|
|
#include "zr/roundstart"
|
2009-04-18 01:44:41 +02:00
|
|
|
#include "zr/roundend"
|
2009-04-22 04:53:19 +02:00
|
|
|
#include "zr/infect"
|
2009-04-19 19:54:21 +02:00
|
|
|
#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-19 19:54:21 +02:00
|
|
|
|
2009-04-29 01:58:41 +02:00
|
|
|
// Modules
|
2009-04-22 04:53:19 +02:00
|
|
|
#include "zr/account"
|
2009-06-08 00:07:30 +02:00
|
|
|
#include "zr/visualeffects/visualeffects"
|
2009-04-16 22:21:32 +02:00
|
|
|
#include "zr/soundeffects/soundeffects"
|
2009-04-17 01:09:52 +02:00
|
|
|
#include "zr/antistick"
|
2009-04-14 22:05:20 +02:00
|
|
|
#include "zr/knockback"
|
2009-04-15 11:27:03 +02:00
|
|
|
#include "zr/spawnprotect"
|
2009-04-16 05:30:26 +02:00
|
|
|
#include "zr/respawn"
|
2009-04-17 10:20:04 +02:00
|
|
|
#include "zr/napalm"
|
2009-05-15 07:25:07 +02:00
|
|
|
#include "zr/jumpboost"
|
2009-04-29 01:58:41 +02:00
|
|
|
#include "zr/zspawn"
|
2009-05-05 06:56:34 +02:00
|
|
|
#include "zr/ztele"
|
2009-04-16 01:18:08 +02:00
|
|
|
#include "zr/zhp"
|
2009-06-22 06:08:26 +02:00
|
|
|
#include "zr/zcookies"
|
2009-05-16 01:37:23 +02:00
|
|
|
#include "zr/volfeatures/volfeatures"
|
2009-07-16 10:05:40 +02:00
|
|
|
#include "zr/debugtools"
|
2009-04-27 04:00:38 +02:00
|
|
|
|
2010-11-14 15:17:19 +01:00
|
|
|
#include "zr/api/api"
|
|
|
|
|
2009-04-29 01:58:41 +02:00
|
|
|
/**
|
2009-05-19 00:58:42 +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",
|
2009-05-08 04:57:21 +02:00
|
|
|
author = "Greyscale | Richard Helgeby",
|
2009-04-29 01:58:41 +02:00
|
|
|
description = "Infection/survival style gameplay",
|
|
|
|
version = VERSION,
|
2012-01-28 02:16:49 +01:00
|
|
|
url = "http://forums.alliedmods.net/forumdisplay.php?f=132"
|
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.
|
2010-07-25 21:08:22 +02:00
|
|
|
*
|
|
|
|
* @return APLRes_Success for load success, APLRes_Failure or APLRes_SilentFailure otherwise.
|
2009-04-29 01:58:41 +02:00
|
|
|
*/
|
2010-07-25 21:08:22 +02:00
|
|
|
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
|
2008-10-04 22:59:11 +02:00
|
|
|
{
|
2010-11-14 15:17:19 +01:00
|
|
|
// Load API.
|
|
|
|
APIInit();
|
2008-10-04 22:59:11 +02:00
|
|
|
|
2009-04-29 01:58:41 +02:00
|
|
|
// Let plugin load.
|
2010-07-25 21:08:22 +02:00
|
|
|
return APLRes_Success;
|
2008-10-04 22:59:11 +02:00
|
|
|
}
|
|
|
|
|
2009-04-29 01:58:41 +02:00
|
|
|
/**
|
|
|
|
* Plugin is loading.
|
|
|
|
*/
|
2008-10-04 22:59:11 +02:00
|
|
|
public OnPluginStart()
|
|
|
|
{
|
2012-08-22 12:42:30 +02:00
|
|
|
UpdateGameFolder();
|
|
|
|
|
2009-05-14 09:32:01 +02:00
|
|
|
// Forward event to modules.
|
2009-06-14 19:10:30 +02:00
|
|
|
LogInit(); // Doesn't depend on CVARs.
|
2009-05-14 09:32:01 +02:00
|
|
|
TranslationInit();
|
2009-04-20 02:56:26 +02:00
|
|
|
CvarsInit();
|
2009-04-29 01:58:41 +02:00
|
|
|
ToolsInit();
|
2009-06-20 09:15:43 +02:00
|
|
|
CookiesInit();
|
2009-05-14 02:28:26 +02:00
|
|
|
CommandsInit();
|
2009-04-13 20:33:13 +02:00
|
|
|
WeaponsInit();
|
2009-04-27 04:00:38 +02:00
|
|
|
EventInit();
|
2008-10-04 22:59:11 +02:00
|
|
|
}
|
|
|
|
|
2009-08-25 22:07:10 +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()
|
|
|
|
{
|
2009-04-13 04:35:11 +02:00
|
|
|
// Forward event to modules.
|
2009-11-11 22:50:19 +01:00
|
|
|
ClassOnMapStart();
|
2009-05-14 02:28:26 +02:00
|
|
|
OverlaysOnMapStart();
|
2009-04-22 04:53:19 +02:00
|
|
|
RoundEndOnMapStart();
|
2009-04-20 02:56:26 +02:00
|
|
|
SEffectsOnMapStart();
|
2009-05-06 03:04:55 +02:00
|
|
|
ZSpawnOnMapStart();
|
2009-09-30 01:05:41 +02:00
|
|
|
VolInit();
|
2009-01-19 22:45:58 +01:00
|
|
|
}
|
|
|
|
|
2009-04-29 01:58:41 +02:00
|
|
|
/**
|
|
|
|
* The map is ending.
|
|
|
|
*/
|
2009-01-19 22:45:58 +01:00
|
|
|
public OnMapEnd()
|
|
|
|
{
|
2009-04-17 01:09:52 +02:00
|
|
|
// Forward event to modules.
|
2012-05-29 23:40:32 +02:00
|
|
|
InfectOnMapEnd();
|
2009-10-31 18:18:11 +01:00
|
|
|
VolOnMapEnd();
|
2010-02-14 16:27:20 +01:00
|
|
|
VEffectsOnMapEnd();
|
2009-10-31 18:18:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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()
|
|
|
|
{
|
2009-05-29 08:43:15 +02:00
|
|
|
// Forward event to modules. (OnConfigsExecuted)
|
2009-04-30 07:36:57 +02:00
|
|
|
ModelsLoad();
|
2009-05-18 06:26:13 +02:00
|
|
|
DownloadsLoad();
|
2009-04-23 06:39:11 +02:00
|
|
|
WeaponsLoad();
|
|
|
|
HitgroupsLoad();
|
|
|
|
InfectLoad();
|
2010-02-14 17:26:28 +01:00
|
|
|
DamageLoad();
|
2009-04-24 05:02:19 +02:00
|
|
|
VEffectsLoad();
|
2009-04-17 01:09:52 +02:00
|
|
|
SEffectsLoad();
|
2010-07-04 17:58:27 +02:00
|
|
|
ClassOnConfigsExecuted();
|
2009-04-25 14:19:14 +02:00
|
|
|
ClassLoad();
|
2009-05-30 04:17:01 +02:00
|
|
|
VolLoad();
|
2009-05-09 17:45:19 +02:00
|
|
|
|
2009-05-29 08:43:15 +02:00
|
|
|
// Forward event to modules. (OnModulesLoaded)
|
2009-05-09 17:45:19 +02:00
|
|
|
ConfigOnModulesLoaded();
|
2009-05-10 18:49:47 +02:00
|
|
|
ClassOnModulesLoaded();
|
2008-10-04 22:59:11 +02:00
|
|
|
}
|
|
|
|
|
2010-02-20 02:41:24 +01:00
|
|
|
/**
|
|
|
|
* Client has just connected to the server.
|
|
|
|
*/
|
|
|
|
public OnClientConnected(client)
|
|
|
|
{
|
|
|
|
// Forward event to modules.
|
|
|
|
ClassOnClientConnected(client);
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2009-04-13 04:35:11 +02:00
|
|
|
// Forward event to modules.
|
2009-04-20 02:56:26 +02:00
|
|
|
ClassClientInit(client);
|
2009-05-14 02:28:26 +02:00
|
|
|
OverlaysClientInit(client);
|
2009-04-22 04:53:19 +02:00
|
|
|
WeaponsClientInit(client);
|
|
|
|
InfectClientInit(client);
|
2009-04-19 19:54:21 +02:00
|
|
|
DamageClientInit(client);
|
2009-04-17 01:09:52 +02:00
|
|
|
SEffectsClientInit(client);
|
2009-07-02 08:23:12 +02:00
|
|
|
AntiStickClientInit(client);
|
2009-04-16 01:18:08 +02:00
|
|
|
SpawnProtectClientInit(client);
|
2009-04-16 05:30:26 +02:00
|
|
|
RespawnClientInit(client);
|
2009-05-05 06:56:34 +02:00
|
|
|
ZTeleClientInit(client);
|
2009-04-16 01:18:08 +02:00
|
|
|
ZHPClientInit(client);
|
2008-10-04 22:59:11 +02:00
|
|
|
}
|
|
|
|
|
2010-02-04 23:53:58 +01:00
|
|
|
/**
|
2010-02-20 02:41:24 +01:00
|
|
|
* Called once a client's saved cookies have been loaded from the database.
|
|
|
|
*
|
|
|
|
* @param client Client index.
|
|
|
|
*/
|
|
|
|
public OnClientCookiesCached(client)
|
|
|
|
{
|
2010-07-10 19:21:49 +02:00
|
|
|
// Check if client disconnected before cookies were done caching.
|
|
|
|
if (!IsClientConnected(client))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-02-20 02:41:24 +01:00
|
|
|
// Forward "OnCookiesCached" event to modules.
|
|
|
|
ClassOnCookiesCached(client);
|
|
|
|
WeaponsOnCookiesCached(client);
|
|
|
|
ZHPOnCookiesCached(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called once a client is authorized and fully in-game, and
|
|
|
|
* after all post-connection authorizations have been performed.
|
|
|
|
*
|
|
|
|
* This callback is gauranteed to occur on all clients, and always
|
|
|
|
* after each OnClientPutInServer() call.
|
2010-02-04 23:53:58 +01:00
|
|
|
*
|
2010-02-20 02:41:24 +01:00
|
|
|
* @param client Client index.
|
|
|
|
* @noreturn
|
2010-02-04 23:53:58 +01:00
|
|
|
*/
|
|
|
|
public OnClientPostAdminCheck(client)
|
|
|
|
{
|
|
|
|
// Forward authorized event to modules that depend on client admin info.
|
2010-02-20 02:41:24 +01:00
|
|
|
ClassOnClientPostAdminCheck(client);
|
2010-02-04 23:53:58 +01: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)
|
|
|
|
{
|
2009-04-13 04:35:11 +02:00
|
|
|
// Forward event to modules.
|
|
|
|
ClassOnClientDisconnect(client);
|
2009-04-16 01:18:08 +02:00
|
|
|
WeaponsOnClientDisconnect(client);
|
2009-04-22 04:53:19 +02:00
|
|
|
InfectOnClientDisconnect(client);
|
|
|
|
DamageOnClientDisconnect(client);
|
2009-07-02 08:23:12 +02:00
|
|
|
AntiStickOnClientDisconnect(client);
|
2009-04-29 01:58:41 +02:00
|
|
|
ZSpawnOnClientDisconnect(client);
|
2009-05-30 04:17:01 +02:00
|
|
|
VolOnPlayerDisconnect(client);
|
2009-05-01 11:22:45 +02:00
|
|
|
}
|
2010-07-04 17:58:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a clients movement buttons are being processed
|
|
|
|
*
|
|
|
|
* @param client Index of the client.
|
|
|
|
* @param buttons Copyback buffer containing the current commands (as bitflags - see entity_prop_stocks.inc).
|
|
|
|
* @param impulse Copyback buffer containing the current impulse command.
|
|
|
|
* @param vel Players desired velocity.
|
|
|
|
* @param angles Players desired view angles.
|
|
|
|
* @param weapon Entity index of the new weapon if player switches weapon, 0 otherwise.
|
|
|
|
* @return Plugin_Handled to block the commands from being processed, Plugin_Continue otherwise.
|
|
|
|
*/
|
|
|
|
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
|
|
|
|
{
|
|
|
|
Class_OnPlayerRunCmd(client, vel);
|
|
|
|
return Plugin_Continue;
|
|
|
|
}
|