sm-zombiereloaded-3/src/zombiereloaded.sp

276 lines
5.7 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
#include "zr/zombiereloaded"
#include "zr/global"
#include "zr/cvars"
#include "zr/translation"
#include "zr/offsets"
#include "zr/models"
#include "zr/overlays"
// Class system
#include "zr/playerclasses/playerclasses"
#include "zr/anticamp"
#include "zr/teleport"
2008-10-04 22:59:11 +02:00
#include "zr/zombie"
#include "zr/menu"
#include "zr/sayhooks"
// Weapons
#include "zr/weapons/weapons"
// Sound effects
#include "zr/soundeffects/soundeffects"
// Antistick
#include "zr/antistick"
// Hitgroups
#include "zr/hitgroups"
// Knockback
#include "zr/knockback"
2009-04-15 11:27:03 +02:00
// Spawn protect
#include "zr/spawnprotect"
// Respawn
#include "zr/respawn"
// ZHP
#include "zr/zhp"
#include "zr/zadmin"
2008-10-04 22:59:11 +02:00
#include "zr/damagecontrol"
#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)
{
CreateGlobals();
return true;
}
public OnPluginStart()
{
LoadTranslations("common.phrases.txt");
LoadTranslations("zombiereloaded.phrases.txt");
// ======================================================================
ZR_PrintToServer("Plugin loading");
// ======================================================================
HookEvents();
HookChatCmds();
CreateCvars();
HookCvars();
CreateCommands();
HookCommands();
FindOffsets();
SetupGameData();
// Weapons
WeaponsInit();
2008-10-04 22:59:11 +02:00
InitDmgControl();
// ======================================================================
market = LibraryExists("market");
// ======================================================================
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"))
{
market = false;
}
}
public OnLibraryAdded(const String:name[])
{
if (StrEqual(name, "market"))
{
market = true;
}
}
public OnMapStart()
{
MapChangeCleanup();
LoadModelData();
LoadDownloadData();
// Forward event to modules.
ClassLoad();
WeaponsLoad();
SEffectsOnMapStart();
HitgroupsLoad();
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);
2009-04-13 04:37:17 +02:00
if (LogFlagCheck(LOG_CORE_EVENTS))
{
LogMessage("Executed map config file: %s", mapconfig);
}
2008-10-04 22:59:11 +02:00
}
FindMapSky();
// Forward event to modules.
SEffectsLoad();
2008-10-04 22:59:11 +02:00
}
public OnClientPutInServer(client)
{
gBlockMotherInfect[client] = false;
// Forward event to modules.
ClassClientInit(client);
SEffectsClientInit(client);
WeaponsClientInit(client);
SpawnProtectClientInit(client);
RespawnClientInit(client);
ZHPClientInit(client);
2008-10-04 22:59:11 +02:00
ClientHookAttack(client);
FindClientDXLevel(client);
for (new x = 0; x < MAXTIMERS; x++)
{
tHandles[client][x] = INVALID_HANDLE;
}
RefreshList();
2008-10-04 22:59:11 +02:00
}
public OnClientDisconnect(client)
{
ClientUnHookAttack(client);
PlayerLeft(client);
// Forward event to modules.
ClassOnClientDisconnect(client);
WeaponsOnClientDisconnect(client);
ZTeleResetClient(client);
2008-10-04 22:59:11 +02:00
for (new x = 0; x < MAXTIMERS; x++)
{
if (tHandles[client][x] != INVALID_HANDLE)
{
KillTimer(tHandles[client][x]);
2008-10-04 22:59:11 +02:00
tHandles[client][x] = INVALID_HANDLE;
}
}
RefreshList();
2008-10-04 22:59:11 +02:00
}
MapChangeCleanup()
{
tRound = INVALID_HANDLE;
tInfect = INVALID_HANDLE;
AntiStickReset();
// x = client index.
for (new x = 1; x <= MaxClients; x++)
{
for (new y = 0; y < MAXTIMERS; y++)
{
if (tHandles[x][y] != INVALID_HANDLE)
{
tHandles[x][y] = INVALID_HANDLE;
}
}
}
2008-10-04 22:59:11 +02:00
}
ZREnd()
{
TerminateRound(3.0, Game_Commencing);
UnhookCvars();
UnhookEvents();
// 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++)
{
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)
{
KillTimer(tHandles[x][y]);
2008-10-04 22:59:11 +02:00
tHandles[x][y] = INVALID_HANDLE;
}
}
}
2009-04-09 06:49:15 +02:00
}