Merged heads.

This commit is contained in:
richard 2009-04-14 23:33:50 +02:00
commit 2bb28b87c1
18 changed files with 479 additions and 881 deletions

View File

@ -1,192 +1,220 @@
// Weapons // Weapons
// //
// Format // Format
// //
// "weaponname" // Name of the weapon (without weapon_ prefix) // "weaponname" // Name of the weapon (without weapon_ prefix)
// { // {
// "restrict" "no" (default) // Restricts the weapon on each map start // "restrict" "no" (default) // Restricts the weapon on each map start
// "menu" "yes" (default) // Allows admins to toggle restriction with the menu // "menu" "yes" (default) // Allows admins to toggle restriction with the menu
// } // "knockback" "1.0" (default) // The knockback multiplier for the weapon
// // }
// Notes: //
// // Notes:
// This is a list of valid weapons for your server, unlisted weapons will //
// be seen as invalid by the weapon restrict module. // This is a list of valid weapons for your server, unlisted weapons will
// // be seen as invalid by the weapon restrict module.
// A config setting set to something other than "yes" or "no" will be assumed as "no." //
// // A config setting set to something other than "yes" or "no" will be assumed as "no."
// A missing config setting will be assumed to be its default value (documented above). //
// // A missing config setting will be assumed to be its default value (documented above).
// Duplicate weapon entries will show up separately in restrict menu, but //
// only the first one's options are used. // Duplicate weapon entries will show up separately in restrict menu, but
// only the first one's options are used.
"weapons" // Counter-Strike: Source weapons
{ "weapons" // Counter-Strike: Source weapons
"Glock" {
{ "Glock"
//"restrict" "no" {
"menu" "yes" "restrict" "no"
} "menu" "yes"
"knockback" "0.8"
"USP" }
{
"restrict" "no" "USP"
//"menu" "yes" {
} "restrict" "no"
"menu" "yes"
"P228" "knockback" "0.8"
{ }
//"restrict" "no"
//"menu" "yes" "P228"
} {
"restrict" "no"
"Deagle" "menu" "yes"
{ "knockback" "1.0"
"restrict" "no" }
"menu" "yes"
} "Deagle"
{
"Elite" "restrict" "no"
{ "menu" "yes"
"restrict" "no" "knockback" "1.2"
"menu" "yes" }
}
"Elite"
"Fiveseven" {
{ "restrict" "no"
"restrict" "no" "menu" "yes"
"menu" "yes" "knockback" "1.0"
} }
"M3" "Fiveseven"
{ {
"restrict" "no" "restrict" "no"
"menu" "yes" "menu" "yes"
} "knockback" "1.0"
}
"XM1014"
{ "M3"
"restrict" "no" {
"menu" "yes" "restrict" "no"
} "menu" "yes"
"knockback" "0.8" // Remember that there are 8 pellets in 1 shot.
"Mac10" }
{
"restrict" "no" "XM1014"
"menu" "yes" {
} "restrict" "no"
"menu" "yes"
"TMP" "knockback" "0.8" // See above comment.
{ }
"restrict" "no"
"menu" "yes" "Mac10"
} {
"restrict" "no"
"MP5Navy" "menu" "yes"
{ "knockback" "1.0"
"restrict" "no" }
"menu" "yes"
} "TMP"
{
"UMP45" "restrict" "no"
{ "menu" "yes"
"restrict" "no" "knockback" "1.0"
"menu" "yes" }
}
"MP5Navy"
"P90" {
{ "restrict" "no"
"restrict" "no" "menu" "yes"
"menu" "yes" "knockback" "1.0"
} }
"Galil" "UMP45"
{ {
"restrict" "no" "restrict" "no"
"menu" "yes" "menu" "yes"
} "knockback" "1.0"
}
"Famas"
{ "P90"
"restrict" "no" {
"menu" "yes" "restrict" "no"
} "menu" "yes"
"knockback" "1.0"
"AK47" }
{
"restrict" "no" "Galil"
"menu" "yes" {
} "restrict" "no"
"menu" "yes"
"M4A1" "knockback" "1.0"
{ }
"restrict" "no"
"menu" "yes" "Famas"
} {
"restrict" "no"
"SG552" "menu" "yes"
{ "knockback" "1.0"
"restrict" "no" }
"menu" "yes"
} "AK47"
{
"AUG" "restrict" "no"
{ "menu" "yes"
"restrict" "no" "knockback" "1.2"
"menu" "yes" }
}
"M4A1"
"Scout" {
{ "restrict" "no"
"restrict" "no" "menu" "yes"
"menu" "yes" "knockback" "1.1"
} }
"SG550" "SG552"
{ {
"restrict" "yes" "restrict" "no"
"menu" "yes" "menu" "yes"
} "knockback" "1.0"
}
"G3SG1"
{ "AUG"
"restrict" "yes" {
"menu" "yes" "restrict" "no"
} "menu" "yes"
"knockback" "1.1"
"AWP" }
{
"restrict" "yes" "Scout"
"menu" "yes" {
} "restrict" "no"
"menu" "yes"
"M249" "knockback" "1.5"
{ }
"restrict" "yes"
"menu" "yes" "SG550"
} {
"restrict" "yes"
"hegrenade" "menu" "yes"
{ "knockback" "1.3"
"restrict" "no" }
"menu" "yes"
} "G3SG1"
{
"flashbang" "restrict" "yes"
{ "menu" "yes"
"restrict" "yes" "knockback" "1.3"
"menu" "no" }
}
"AWP"
"smokegrenade" {
{ "restrict" "yes"
"restrict" "yes" "menu" "yes"
"menu" "no" "knockback" "1.8"
} }
"NVGs" "M249"
{ {
"restrict" "yes" "restrict" "yes"
"menu" "no" "menu" "yes"
} "knockback" "1.2"
} }
"hegrenade"
{
"restrict" "no"
"menu" "yes"
"knockback" "6.0"
}
"flashbang"
{
"restrict" "yes"
"menu" "no"
"knockback" "100.0"
}
"smokegrenade"
{
"restrict" "yes"
"menu" "no"
"knockback" "100.0"
}
"NVGs"
{
"restrict" "yes"
"menu" "no"
}
}

View File

@ -1,42 +1,3 @@
/** // ===============================
* ==================== // Zombie:Reloaded External API
* Zombie:Reloaded // ===============================
* File: zr.inc
* Author: Greyscale
* ====================
*/
/**
* Used to check if a player is a zombie.
* @param client Client index.
* @return True if the player is a zombie, and false if human.
*/
native bool:ZR_IsClientZombie(client);
/**
* Returns the client's zombie class.
* @param client Client index.
* @return The client's zombie class.
*/
native ZR_GetClientZClass(client);
/**
* Returns if the zombie has spawned or not.
* @return Returns true, if the first zombie has spawned during the round, false if not.
*/
native bool:ZR_HasZombieSpawned();
/**
* Called when a player turns into a zombie.
* @param client Client index.
* @param mother True if zombie is a mother, false if zombified by another zombie.
*/
forward ZR_Zombify(client, bool:mother);
/**
* Called when a player changes their zombie class.
* @param client Client index.
* @param oldclass The client's old class.
* @param newclass The client's new class.
*/
forward ZR_OnZClassChanged(client, oldclass, newclass);

View File

@ -23,7 +23,6 @@
#include "zr/translation" #include "zr/translation"
#include "zr/offsets" #include "zr/offsets"
#include "zr/ambience" #include "zr/ambience"
#include "zr/classes"
#include "zr/models" #include "zr/models"
#include "zr/overlays" #include "zr/overlays"
#include "zr/playerclasses/playerclasses" #include "zr/playerclasses/playerclasses"
@ -37,6 +36,9 @@
// Weapons // Weapons
#include "zr/weapons/weapons" #include "zr/weapons/weapons"
// Knockback
#include "zr/knockback"
#include "zr/zadmin" #include "zr/zadmin"
#include "zr/damagecontrol" #include "zr/damagecontrol"
#include "zr/commands" #include "zr/commands"
@ -122,15 +124,8 @@ public OnMapStart()
LoadModelData(); LoadModelData();
LoadDownloadData(); LoadDownloadData();
new i;
new classindex = GetDefaultClassIndex();
for (i = 1; i <= MAXPLAYERS; i++)
{
pClass[i] = classindex;
}
// Forward event to modules. // Forward event to modules.
ClassLoad();
WeaponsOnMapStart(); WeaponsOnMapStart();
Anticamp_Startup(); Anticamp_Startup();
} }
@ -153,6 +148,7 @@ public OnConfigsExecuted()
if (FileExists(path)) if (FileExists(path))
{ {
ServerCommand("exec %s", mapconfig); ServerCommand("exec %s", mapconfig);
if (LogFlagCheck(LOG_CORE_EVENTS)) if (LogFlagCheck(LOG_CORE_EVENTS))
{ {
LogMessage("Executed map config file: %s", mapconfig); LogMessage("Executed map config file: %s", mapconfig);
@ -160,15 +156,11 @@ public OnConfigsExecuted()
} }
FindMapSky(); FindMapSky();
ClassLoad();
LoadClassData();
LoadAmbienceData(); LoadAmbienceData();
} }
public OnClientPutInServer(client) public OnClientPutInServer(client)
{ {
pClass[client] = GetDefaultClassIndex();
gBlockMotherInfect[client] = false; gBlockMotherInfect[client] = false;
gKilledByWorld[client] = false; gKilledByWorld[client] = false;

View File

@ -47,44 +47,6 @@ AntiStickReset()
tAntiStick = INVALID_HANDLE; tAntiStick = INVALID_HANDLE;
} }
/**
* Pushes a player away from another to prevent sticking. (Used on infect)
*
* @param attacker The player to push away.
* @param client The client to push player away from.
*/
AntiStick(attacker, client)
{
// Validate player is valid client and in-game
if (!attacker || !IsClientInGame(attacker))
{
return;
}
// Retrieve cvar value for force of the push, if 0 is returned, stop function
new Float:force = GetConVarFloat(gCvars[CVAR_INFECT_ANTISTICK_FORCE]);
if (force == 0.0)
{
return;
}
new Float:vector[3];
new Float:attackerloc[3];
new Float:clientloc[3];
GetClientAbsOrigin(attacker, attackerloc);
GetClientAbsOrigin(client, clientloc);
MakeVectorFromPoints(attackerloc, clientloc, vector);
NormalizeVector(vector, vector);
ScaleVector(vector, force);
// Push player
TeleportEntity(attacker, NULL_VECTOR, NULL_VECTOR, vector);
}
/** /**
* Checks if a player is currently stuck within another player * Checks if a player is currently stuck within another player
* *

View File

@ -1,392 +0,0 @@
/**
* ====================
* Zombie:Reloaded
* File: classes.inc
* Author: Greyscale
* ====================
*/
enum ZR_ClassOptions
{
String:data_name[64],
String:data_model[256],
String:data_menu_description[256],
String:data_zvision[256],
data_health,
Float:data_speed,
Float:data_jump_distance,
Float:data_jump_height,
Float:data_knockback,
data_nvgs,
data_fov,
bool:data_regen,
data_regen_health,
Float:data_regen_interval,
bool:data_napalm,
Float:data_napalm_time,
bool:data_nofalldamage,
data_kill_bonus,
data_infect_health,
data_alpha_spawn,
data_alpha_damaged,
data_alpha_damage
}
#define MAXCLASSES 20
new Handle:kvClasses = INVALID_HANDLE;
new arrayClasses[MAXCLASSES][ZR_ClassOptions];
new classCount;
LoadClassData()
{
if (kvClasses != INVALID_HANDLE)
{
CloseHandle(kvClasses);
}
kvClasses = CreateKeyValues("classes");
decl String:path[PLATFORM_MAX_PATH];
BuildPath(Path_SM, path, sizeof(path), "configs/zr/classes.txt");
if (!FileToKeyValues(kvClasses, path))
{
SetFailState("\"%s\" missing from server", path);
}
KvRewind(kvClasses);
if (!KvGotoFirstSubKey(kvClasses))
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
SetConVarBool(gCvars[CVAR_CLASSES], false);
ZR_LogMessage("Class auto-disable", path);
}
}
decl String:name[64];
decl String:model[256];
decl String:menu_description[256];
decl String:zvision[256];
classCount = 0;
do
{
KvGetString(kvClasses, "name", name, sizeof(name));
strcopy(arrayClasses[classCount][data_name], 64, name);
KvGetString(kvClasses, "model", model, sizeof(model));
strcopy(arrayClasses[classCount][data_model], 256, model);
KvGetString(kvClasses, "menu_description", menu_description, sizeof(menu_description));
strcopy(arrayClasses[classCount][data_menu_description], 256, menu_description);
decl String:cvar_zvision[256];
GetConVarString(gCvars[CVAR_ZOMBIE_ZVISION], cvar_zvision, sizeof(cvar_zvision));
KvGetString(kvClasses, "zvision", zvision, sizeof(zvision), cvar_zvision);
strcopy(arrayClasses[classCount][data_zvision], 256, zvision);
arrayClasses[classCount][data_health] = KvGetNum(kvClasses, "health"), GetConVarInt(gCvars[CVAR_ZOMBIE_HEALTH]);
arrayClasses[classCount][data_speed] = KvGetFloat(kvClasses, "speed"), GetConVarFloat(gCvars[CVAR_ZOMBIE_SPEED]);
arrayClasses[classCount][data_jump_distance] = KvGetFloat(kvClasses, "jump_distance"), GetConVarFloat(gCvars[CVAR_ZOMBIE_JUMP_DISTANCE]);
arrayClasses[classCount][data_jump_height] = KvGetFloat(kvClasses, "jump_height"), GetConVarFloat(gCvars[CVAR_ZOMBIE_JUMP_HEIGHT]);
arrayClasses[classCount][data_knockback] = KvGetFloat(kvClasses, "knockback"), GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
arrayClasses[classCount][data_nvgs] = KvGetNum(kvClasses, "nvgs"), GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]);
arrayClasses[classCount][data_fov] = KvGetNum(kvClasses, "fov"), GetConVarInt(gCvars[CVAR_ZOMBIE_FOV]);
arrayClasses[classCount][data_regen] = bool:KvGetNum(kvClasses, "regen"), GetConVarBool(gCvars[CVAR_ZOMBIE_REGEN]);
arrayClasses[classCount][data_regen_health] = KvGetNum(kvClasses, "regen_health"), GetConVarInt(gCvars[CVAR_ZOMBIE_REGEN_HEALTH]);
arrayClasses[classCount][data_regen_interval] = KvGetFloat(kvClasses, "regen_interval"), GetConVarFloat(gCvars[CVAR_ZOMBIE_REGEN_INTERVAL]);
arrayClasses[classCount][data_napalm] = bool:KvGetNum(kvClasses, "napalm"), GetConVarBool(gCvars[CVAR_ZOMBIE_NAPALM]);
arrayClasses[classCount][data_napalm_time] = KvGetFloat(kvClasses, "napalm_time"), GetConVarFloat(gCvars[CVAR_ZOMBIE_NAPALM_TIME]);
arrayClasses[classCount][data_nofalldamage] = bool:KvGetNum(kvClasses, "nofalldamage"), GetConVarBool(gCvars[CVAR_ZOMBIE_NOFALLDAMAGE]);
arrayClasses[classCount][data_kill_bonus] = KvGetNum(kvClasses, "kill_bonus"), GetConVarInt(gCvars[CVAR_ZOMBIE_KILL_BONUS]);
arrayClasses[classCount][data_infect_health] = KvGetNum(kvClasses, "infect_health"), GetConVarInt(gCvars[CVAR_ZOMBIE_INFECT_HEALTH]);
arrayClasses[classCount][data_alpha_spawn] = KvGetNum(kvClasses, "alpha_spawn");
arrayClasses[classCount][data_alpha_damaged] = KvGetNum(kvClasses, "alpha_damaged");
arrayClasses[classCount][data_alpha_damage] = KvGetNum(kvClasses, "alpha_damage");
classCount++;
} while (KvGotoNextKey(kvClasses));
}
GetClassName(classindex, String:name[], maxlen)
{
strcopy(name, maxlen, arrayClasses[classindex][data_name]);
}
GetClassIndex(String:name[])
{
new i;
decl String:current_name[64];
for (i = 0; i < classCount; i++)
{
GetClassName(i, current_name, sizeof(current_name));
if (strcmp(name, current_name, false) == 0)
{
return i;
}
}
return -1;
}
GetDefaultClassIndex()
{
new String:classname[64];
new classindex;
GetConVarString(gCvars[CVAR_CLASSES_DEFAULT], classname, sizeof(classname));
if (strlen(classname) > 0)
{
if (classCount > 1 && (strcmp(classname, "random", false) == 0))
{
classindex = GetRandomInt(0, classCount - 1);
return classindex;
}
else
{
classindex = GetClassIndex(classname);
if (classindex == -1)
{
return 0;
}
else
{
return classindex;
}
}
}
else
{
return 0;
}
}
/*GetClassModel(classindex, String:model[], maxlen)
{
strcopy(model, maxlen, arrayClasses[classindex][data_model]);
}*/
GetClassMenuDescription(classindex, String:menudescription[], maxlen)
{
strcopy(menudescription, maxlen, arrayClasses[classindex][data_menu_description]);
}
/*GetClassZVision(classindex, String:zvision[], maxlen)
{
strcopy(zvision, maxlen, arrayClasses[classindex][data_zvision]);
}*/
/*GetClassHealth(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_health];
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_HEALTH]);
}*/
/*Float:GetClassSpeed(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_speed];
}
return GetConVarFloat(gCvars[CVAR_ZOMBIE_SPEED]);
}*/
/*Float:GetClassJumpDistance(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_jump_distance];
}
return GetConVarFloat(gCvars[CVAR_ZOMBIE_JUMP_DISTANCE]);
}*/
/*Float:GetClassJumpHeight(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_jump_height];
}
return GetConVarFloat(gCvars[CVAR_ZOMBIE_JUMP_HEIGHT]);
}*/
/*Float:GetClassKnockback(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_knockback] * GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
}
return GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
}*/
/*bool:GetClassNVGs(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
new nvgs_override = GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]);
if (nvgs_override > -1)
{
return IntToBool(nvgs_override);
}
else
{
return IntToBool(arrayClasses[classindex][data_nvgs]);
}
}
return IntToBool(GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]));
}*/
/*GetClassFOV(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_fov];
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_FOV]);
}*/
/*bool:GetClassRegen(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_regen];
}
return GetConVarBool(gCvars[CVAR_ZOMBIE_REGEN]);
}*/
/*GetClassRegenHealth(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_regen_health];
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_REGEN_HEALTH]);
}*/
/*Float:GetClassRegenInterval(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_regen_interval];
}
return GetConVarFloat(gCvars[CVAR_ZOMBIE_REGEN_INTERVAL]);
}*/
/*bool:GetClassNapalm(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_napalm];
}
return GetConVarBool(gCvars[CVAR_ZOMBIE_NAPALM]);
}*/
/*Float:GetClassNapalmTime(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_napalm_time];
}
return GetConVarFloat(gCvars[CVAR_ZOMBIE_NAPALM_TIME]);
}*/
/*bool:GetClassNoFallDamage(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_nofalldamage];
}
return GetConVarBool(gCvars[CVAR_ZOMBIE_NOFALLDAMAGE]);
}*/
/*GetClassKillBonus(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_kill_bonus];
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_KILL_BONUS]);
}*/
/*GetClassInfectHealth(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_infect_health];
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_INFECT_HEALTH]);
}*/
/*GetClassAlphaSpawn(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_alpha_spawn];
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_ALPHA_SPAWN]);
}*/
/*GetClassAlphaDamaged(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_alpha_damaged];
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_ALPHA_DAMAGED]);
}*/
/*GetClassAlphaDamage(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_alpha_damage];
}
return GetConVarInt(gCvars[CVAR_ZOMBIE_ALPHA_DAMAGE]);
}*/

View File

@ -20,11 +20,11 @@ CreateCommands()
RegAdminCmd("zr_restrict", Command_Restrict, ADMFLAG_GENERIC, "Restrict a specified weapon"); RegAdminCmd("zr_restrict", Command_Restrict, ADMFLAG_GENERIC, "Restrict a specified weapon");
RegAdminCmd("zr_unrestrict", Command_Unrestrict, ADMFLAG_GENERIC, "Unrestrict a specified weapon"); RegAdminCmd("zr_unrestrict", Command_Unrestrict, ADMFLAG_GENERIC, "Unrestrict a specified weapon");
RegAdminCmd("zr_set_class_knockback", Command_SetClassKnockback, ADMFLAG_GENERIC, "Sets the knockback to the specified class. Usage: zr_set_class_knockback <class name> <value>"); //RegAdminCmd("zr_set_class_knockback", Command_SetClassKnockback, ADMFLAG_GENERIC, "Sets the knockback to the specified class. Usage: zr_set_class_knockback <class name> <value>");
RegAdminCmd("zr_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback <class name>"); //RegAdminCmd("zr_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback <class name>");
RegAdminCmd("zr_admin", Command_AdminMenu, ADMFLAG_GENERIC, "Displays the admin menu for Zombie: Reloaded."); RegAdminCmd("zr_admin", Command_AdminMenu, ADMFLAG_GENERIC, "Displays the admin menu for Zombie: Reloaded.");
RegAdminCmd("zr_knockback_m", Command_KnockbackMMenu, ADMFLAG_GENERIC, "Displays the knockback multiplier menu."); //RegAdminCmd("zr_knockback_m", Command_KnockbackMMenu, ADMFLAG_GENERIC, "Displays the knockback multiplier menu.");
RegAdminCmd("zr_teleadmin", Command_TeleMenu, ADMFLAG_GENERIC, "Displays the teleport admin menu for Zombie: Reloaded."); RegAdminCmd("zr_teleadmin", Command_TeleMenu, ADMFLAG_GENERIC, "Displays the teleport admin menu for Zombie: Reloaded.");
RegAdminCmd("zr_anticamp_create_volume", Command_AnticampCreateVolume, ADMFLAG_GENERIC, "Creates a rectangular hurt volume between two points. Usage: ht_create_volume <damage> <interval> <x1> <y1> <z1> <x2> <y2> <z2>"); RegAdminCmd("zr_anticamp_create_volume", Command_AnticampCreateVolume, ADMFLAG_GENERIC, "Creates a rectangular hurt volume between two points. Usage: ht_create_volume <damage> <interval> <x1> <y1> <z1> <x2> <y2> <z2>");
@ -192,7 +192,7 @@ public Action:Command_Unrestrict(client, argc)
return Plugin_Handled; return Plugin_Handled;
} }
public Action:Command_SetClassKnockback(client, argc) /*public Action:Command_SetClassKnockback(client, argc)
{ {
if (argc < 2) if (argc < 2)
{ {
@ -245,7 +245,7 @@ public Action:Command_GetClassKnockback(client, argc)
ReplyToCommand(client, "Current knockback for %s: %f", classname, knockback); ReplyToCommand(client, "Current knockback for %s: %f", classname, knockback);
return Plugin_Handled; return Plugin_Handled;
} }*/
public Action:Command_AdminMenu(client, argc) public Action:Command_AdminMenu(client, argc)
{ {
@ -255,7 +255,8 @@ public Action:Command_AdminMenu(client, argc)
} }
else else
{ {
ReplyToCommand(client, "This menu cannot be used from the console."); // BAD!
// ReplyToCommand(client, "This menu cannot be used from the console.");
} }
return Plugin_Handled; return Plugin_Handled;
} }
@ -264,11 +265,13 @@ public Action:Command_KnockbackMMenu(client, argc)
{ {
if (IsClientPlayer(client)) if (IsClientPlayer(client))
{ {
ZRKnockbackMMenu(client); // Disabled, under construction.
// ZRKnockbackMMenu(client);
} }
else else
{ {
ReplyToCommand(client, "This menu cannot be used from the console."); // Tsk tsk no translation? :P
//ReplyToCommand(client, "This menu cannot be used from the console.");
} }
return Plugin_Handled; return Plugin_Handled;
} }
@ -281,6 +284,7 @@ public Action:Command_TeleMenu(client, argc)
} }
else else
{ {
// BAD!
ReplyToCommand(client, "This menu cannot be used from the console."); ReplyToCommand(client, "This menu cannot be used from the console.");
} }
return Plugin_Handled; return Plugin_Handled;

View File

@ -27,8 +27,6 @@ enum ZRSettings
Handle:CVAR_ZOMBIE_SPEED, Handle:CVAR_ZOMBIE_SPEED,
Handle:CVAR_ZOMBIE_JUMP_DISTANCE, Handle:CVAR_ZOMBIE_JUMP_DISTANCE,
Handle:CVAR_ZOMBIE_JUMP_HEIGHT, Handle:CVAR_ZOMBIE_JUMP_HEIGHT,
Handle:CVAR_ZOMBIE_KNOCKBACK,
Handle:CVAR_ZOMBIE_KNOCKBACK_GRENADE,
Handle:CVAR_ZOMBIE_NVGS, Handle:CVAR_ZOMBIE_NVGS,
Handle:CVAR_ZOMBIE_FOV, Handle:CVAR_ZOMBIE_FOV,
Handle:CVAR_ZOMBIE_REGEN, Handle:CVAR_ZOMBIE_REGEN,
@ -118,8 +116,6 @@ CreateCvars()
gCvars[CVAR_ZOMBIE_SPEED] = CreateConVar("zr_zombie_speed", "350", "How fast zombies travel (300: Default speed, 600: Double speed)"); gCvars[CVAR_ZOMBIE_SPEED] = CreateConVar("zr_zombie_speed", "350", "How fast zombies travel (300: Default speed, 600: Double speed)");
gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)"); gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)");
gCvars[CVAR_ZOMBIE_JUMP_HEIGHT] = CreateConVar("zr_zombie_jump_height", "10.0", "How high a zombie jumps (0: Regular jump height)"); gCvars[CVAR_ZOMBIE_JUMP_HEIGHT] = CreateConVar("zr_zombie_jump_height", "10.0", "How high a zombie jumps (0: Regular jump height)");
gCvars[CVAR_ZOMBIE_KNOCKBACK] = CreateConVar("zr_zombie_knockback", "1", "How far zombies are pushed back when shot. If classes are enabled: This one is a multiplier for class knockback values (1: Default)");
gCvars[CVAR_ZOMBIE_KNOCKBACK_GRENADE] = CreateConVar("zr_zombie_knockback_grenade", "4.0", "Knockback multiplier when a grenade inflicts damage on a zombie. (4.0: Default)");
gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will be equipped with nightvision. Also used to override class nvgs if non-negative. (-1: No override, uses class setting, 0: No nvgs, 1: Nvgs on)"); gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will be equipped with nightvision. Also used to override class nvgs if non-negative. (-1: No override, uses class setting, 0: No nvgs, 1: Nvgs on)");
gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)"); gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)");
gCvars[CVAR_ZOMBIE_REGEN] = CreateConVar("zr_zombie_regen", "0", "Zombies will regenerate health"); gCvars[CVAR_ZOMBIE_REGEN] = CreateConVar("zr_zombie_regen", "0", "Zombies will regenerate health");

View File

@ -185,18 +185,6 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
// Remove night vision. // Remove night vision.
NightVisionOn(index, false); NightVisionOn(index, false);
NightVision(index, false); NightVision(index, false);
if (pNextClass[index] != -1)
{
Call_StartForward(hOnZClassChanged);
Call_PushCell(index);
Call_PushCell(pClass[index]);
Call_PushCell(pNextClass[index]);
Call_Finish();
pClass[index] = pNextClass[index];
pNextClass[index] = -1;
}
pProtect[index] = false; pProtect[index] = false;
if (zombieSpawned) if (zombieSpawned)
@ -252,11 +240,14 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
new index = GetClientOfUserId(GetEventInt(event, "userid")); new index = GetClientOfUserId(GetEventInt(event, "userid"));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new dmg = GetEventInt(event, "dmg_health"); new dmg_health = GetEventInt(event, "dmg_health");
decl String:weapon[32]; decl String:weapon[32];
GetEventString(event, "weapon", weapon, sizeof(weapon)); GetEventString(event, "weapon", weapon, sizeof(weapon));
// Forward event to modules.
KnockbackPlayerHurt(index, attacker, weapon, dmg_health);
// Check if the attacker is a player. // Check if the attacker is a player.
if (attacker != 0) if (attacker != 0)
{ {
@ -269,41 +260,6 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
Zombify(index, attacker); Zombify(index, attacker);
} }
} }
// Check if a human attacks a zombie.
if (IsPlayerZombie(index) && IsPlayerHuman(attacker))
{
// Get zombie knockback value.
new Float:knockback = ClassGetKnockback(index);
new Float:clientloc[3];
new Float:attackerloc[3];
GetClientAbsOrigin(index, clientloc);
// Check if a grenade was thrown.
if (StrEqual(weapon, "hegrenade"))
{
// Get the location of the grenade.
FindExplodingGrenade(attackerloc);
// Give knockback on the victim.
KnockBack(index, clientloc, attackerloc, knockback, dmg, true);
}
else
{
GetPlayerEyePosition(attacker, attackerloc);
new Float:attackerang[3];
GetPlayerEyeAngles(attacker, attackerang);
// Calculate victim location.
TR_TraceRayFilter(attackerloc, attackerang, MASK_ALL, RayType_Infinite, TraceRayFilter);
TR_GetEndPosition(clientloc);
KnockBack(index, clientloc, attackerloc, knockback, dmg, false);
}
}
} }
// Check if the player is a human. // Check if the player is a human.
@ -337,41 +293,6 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
UpdateHPDisplay(index); UpdateHPDisplay(index);
} }
public bool:TraceRayFilter(entity, contentsMask)
{
if (entity > 0 && entity < MAXPLAYERS)
{
return false;
}
return true;
}
FindExplodingGrenade(Float:heLoc[3])
{
decl String:classname[64];
new maxentities = GetMaxEntities();
for (new x = GetMaxClients(); x <= maxentities; x++)
{
if (IsValidEdict(x))
{
GetEdictClassname(x, classname, sizeof(classname));
if (StrEqual(classname, "hegrenade_projectile"))
{
new takedamage = GetEntProp(x, Prop_Data, "m_takedamage");
if (takedamage == 0)
{
GetEntPropVector(x, Prop_Send, "m_vecOrigin", heLoc);
return x;
}
}
}
}
return -1;
}
public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{ {
new index = GetClientOfUserId(GetEventInt(event, "userid")); new index = GetClientOfUserId(GetEventInt(event, "userid"));

View File

@ -6,31 +6,9 @@
* ==================== * ====================
*/ */
new Handle:hZombify = INVALID_HANDLE; /**
new Handle:hOnZClassChanged = INVALID_HANDLE; * All external API natives are created here.
*/
CreateGlobals() CreateGlobals()
{ {
CreateNative("ZR_IsClientZombie", Native_IsClientZombie);
CreateNative("ZR_GetClientZClass", Native_GetClientZClass);
CreateNative("ZR_HasZombieSpawned", Native_HasZombieSpawned);
hZombify = CreateGlobalForward("ZR_Zombify", ET_Ignore, Param_Cell, Param_Cell);
hOnZClassChanged = CreateGlobalForward("ZR_OnZClassChanged", ET_Ignore, Param_Cell, Param_Cell, Param_Cell);
}
public Native_IsClientZombie(Handle:plugin, argc)
{
return gZombie[GetNativeCell(1)];
}
public Native_GetClientZClass(Handle:plugin, argc)
{
new class = GetNativeCell(1);
return pClass[class];
}
public Native_HasZombieSpawned(Handle:plugin, argc)
{
return zombieSpawned;
} }

167
src/zr/knockback.inc Normal file
View File

@ -0,0 +1,167 @@
/**
* ====================
* Zombie:Reloaded
* File: knockback.inc
* Author: Greyscale
* ====================
*/
/**
* @section Player hitgroup values.
*/
#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
#define HITGROUP_GEAR 10
/**
* @endsection
*/
/** Player hurt event
* @param client The victim index. (zombie)
* @param attacker The attacker index. (human)
* @param weapon The weapon used.
* @param dmg_health Damage done.
*/
KnockbackPlayerHurt(client, attacker, const String:weapon[], dmg_health)
{
// Check if the attacker is a player.
if (attacker != 0)
{
// Check if a human attacks a zombie.
if (IsPlayerZombie(client) && IsPlayerHuman(attacker))
{
// Get zombie knockback value.
new Float:knockback = ClassGetKnockback(client);
new Float:clientloc[3];
new Float:attackerloc[3];
GetClientAbsOrigin(client, clientloc);
// Check if a grenade was thrown.
if (StrEqual(weapon, "hegrenade"))
{
// Get the location of the grenade.
if (KnockbackFindExplodingGrenade(attackerloc) == -1)
{
// If the grenade wasn't found, then stop.
return;
}
}
else
{
// Get attackers eye position.
GetPlayerEyePosition(attacker, attackerloc);
// Get attackers eye angles.
new Float:attackerang[3];
GetPlayerEyeAngles(attacker, attackerang);
// Calculate knockback end-vector.
TR_TraceRayFilter(attackerloc, attackerang, MASK_ALL, RayType_Infinite, KnockbackTRFilter);
TR_GetEndPosition(clientloc);
}
// Apply damage knockback multiplier
knockback *= float(dmg_health);
// Retrieve weapon knockback boost.
new Float:boostWeapon = WeaponGetWeaponKnockback(weapon);
// Apply weapon knockback multiplier.
knockback *= boostWeapon;
// Apply knockback.
KnockbackSetVelocity(client, attackerloc, clientloc, knockback);
}
}
}
/**
* Sets velocity on a player.
* @param client The client index.
* @param startpoint The starting coordinate to push from.
* @param endpoint The ending coordinate to push towards.
* @param magnitude Magnitude of the push.
*/
KnockbackSetVelocity(client, const Float:startpoint[3], const Float:endpoint[3], Float:magnitude)
{
// Create vector from the given starting and ending points.
new Float:vector[3];
MakeVectorFromPoints(startpoint, endpoint, vector);
// Normalize the vector (equal magnitude at varying distances).
NormalizeVector(vector, vector);
// Apply the magnitude by scaling the vector (multiplying each of its components).
ScaleVector(vector, magnitude);
// ADD the given vector to the clients current velocity.
SetPlayerVelocity(client, vector, false);
}
/**
* Trace Ray forward, used as a filter to continue tracing if told so. (See sdktools_trace.inc)
* @param entity The entity index.
* @param contentsMask The contents mask.
* @return True to allow hit, false to continue tracing.
*/
public bool:KnockbackTRFilter(entity, contentsMask)
{
// If entity is a player, continue tracing.
if (entity > 0 && entity < MAXPLAYERS)
{
return false;
}
// Allow hit.
return true;
}
/**
* Find the location of an exploding grenade (currently inflicting damage in player_hurt).
* @param heLoc The location of the exploding grenade.
* @return The entity index of the grenade.
*/
KnockbackFindExplodingGrenade(Float:heLoc[3])
{
decl String:classname[64];
// Find max entities and loop through all of them.
new maxentities = GetMaxEntities();
for (new x = MaxClients; x <= maxentities; x++)
{
// If entity is invalid, then stop.
if (!IsValidEdict(x))
{
continue;
}
// If entity isn't a grenade, then stop.
GetEdictClassname(x, classname, sizeof(classname));
if (!StrEqual(classname, "hegrenade_projectile", false))
{
continue;
}
// If m_takedamage is set to 0, we found our grenade.
new takedamage = GetEntProp(x, Prop_Data, "m_takedamage");
if (takedamage == 0)
{
// Return its location.
GetEntPropVector(x, Prop_Send, "m_vecOrigin", heLoc);
// Return its entity index.
return x;
}
}
// Didn't find the grenade.
return -1;
}

View File

@ -24,7 +24,7 @@ MainMenu(client)
Format(zmenu, sizeof(zmenu), "%t", "!zmenu menu"); Format(zmenu, sizeof(zmenu), "%t", "!zmenu menu");
Format(zadmin, sizeof(zadmin), "%t", "!zmenu admin"); Format(zadmin, sizeof(zadmin), "%t", "!zmenu admin");
Format(zclass, sizeof(zclass), "%t", "!zmenu class"); Format(zclass, sizeof(zclass), "%t", "!zmenu class", ITEMDRAW_DISABLED);
Format(zmarket, sizeof(zmarket), "%t", "!zmenu market"); Format(zmarket, sizeof(zmarket), "%t", "!zmenu market");
Format(zspawn, sizeof(zspawn), "%t", "!zmenu spawn"); Format(zspawn, sizeof(zspawn), "%t", "!zmenu spawn");
Format(ztele, sizeof(ztele), "%t", "!zmenu tele"); Format(ztele, sizeof(ztele), "%t", "!zmenu tele");
@ -74,10 +74,10 @@ public MainMenuHandle(Handle:menu_main, MenuAction:action, client, slot)
} }
case 2: case 2:
{ {
if (!ZClass(client)) /*if (!ZClass(client))
{ {
MainMenu(client); MainMenu(client);
} }*/
} }
case 3: case 3:
{ {
@ -110,7 +110,7 @@ public MainMenuHandle(Handle:menu_main, MenuAction:action, client, slot)
} }
} }
ClassMenu(client) /**ClassMenu(client)
{ {
new Handle:menu_classes = CreateMenu(ClassMenuHandle); new Handle:menu_classes = CreateMenu(ClassMenuHandle);
@ -184,4 +184,4 @@ public ClassMenuHandle(Handle:menu_classes, MenuAction:action, client, slot)
{ {
CloseHandle(menu_classes); CloseHandle(menu_classes);
} }
} }*/

View File

@ -45,35 +45,27 @@ ClassOnClientSpawn(client)
if (showmenu && !randomclass) if (showmenu && !randomclass)
{ {
ClassMenu(client); //ClassMenu(client);
} }
// Assign random classes if enabled. // Assign random classes if enabled.
GetClientAuthString(client, steamid, sizeof(steamid)); GetClientAuthString(client, steamid, sizeof(steamid));
if (StrEqual(steamid, "BOT") || randomclass) if (StrEqual(steamid, "BOT") || randomclass)
{ {
// Old class system. // Get player's team
new classindex = GetRandomInt(0, classCount - 1);
Call_StartForward(hOnZClassChanged);
Call_PushCell(client);
Call_PushCell(pClass[client]);
Call_PushCell(classindex);
Call_Finish();
pClass[client] = classindex;
// New class system.
new teamid = GetClientTeam(client); new teamid = GetClientTeam(client);
// If the first zombie spawned, and the player is on the terrorist team, then
// find a random zombie class, otherwise find a human class.
if (zombieSpawned && teamid == CS_TEAM_T) if (zombieSpawned && teamid == CS_TEAM_T)
{ {
classindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES); new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES);
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = classindex; ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
ClassGetName(client, classname, sizeof(classname)); ClassGetName(client, classname, sizeof(classname));
} }
else else
{ {
classindex = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS); new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS);
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = classindex; ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = classindex;
ClassGetName(client, classname, sizeof(classname)); ClassGetName(client, classname, sizeof(classname));
} }

View File

@ -561,8 +561,6 @@ bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIF
*/ */
ClassClientSetDefaultIndexes(client = -1) ClassClientSetDefaultIndexes(client = -1)
{ {
new classindex = GetDefaultClassIndex(); // Old class system. Not removed for backwards compatibility.
// Get indexes. // Get indexes.
new zombieindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_ZOMBIES); new zombieindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_ZOMBIES);
new humanindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_HUMANS); new humanindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_HUMANS);
@ -613,10 +611,6 @@ ClassClientSetDefaultIndexes(client = -1)
// Check if a client is specified. // Check if a client is specified.
if (client > 0) if (client > 0)
{ {
// Set the old array for backwards compatibility while introducing the
// new class system.
pClass[client] = classindex;
ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = zombieindex; ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = zombieindex;
ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = humanindex; ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = humanindex;
ClassSelected[client][ZR_CLASS_TEAM_ADMINS] = adminindex; ClassSelected[client][ZR_CLASS_TEAM_ADMINS] = adminindex;
@ -629,10 +623,6 @@ ClassClientSetDefaultIndexes(client = -1)
// No client specified. Loop through all players. // No client specified. Loop through all players.
for (new clientindex = 1; clientindex <= MAXPLAYERS; clientindex++) for (new clientindex = 1; clientindex <= MAXPLAYERS; clientindex++)
{ {
// Set the old array for backwards compatibility while introducing the
// new class system.
pClass[clientindex] = classindex;
ClassSelected[clientindex][ZR_CLASS_TEAM_ZOMBIES] = zombieindex; ClassSelected[clientindex][ZR_CLASS_TEAM_ZOMBIES] = zombieindex;
ClassSelected[clientindex][ZR_CLASS_TEAM_HUMANS] = humanindex; ClassSelected[clientindex][ZR_CLASS_TEAM_HUMANS] = humanindex;
ClassSelected[clientindex][ZR_CLASS_TEAM_ADMINS] = adminindex; ClassSelected[clientindex][ZR_CLASS_TEAM_ADMINS] = adminindex;

View File

@ -35,10 +35,10 @@ public Action:SayCommand(client, argc)
ZRAdminMenu(client); ZRAdminMenu(client);
} }
else if (StrEqual(args, "!zclass", false)) /*else if (StrEqual(args, "!zclass", false))
{ {
ZClass(client); ZClass(client);
} }*/
else if (StrEqual(args, "!zmarket", false)) else if (StrEqual(args, "!zmarket", false))
{ {
@ -77,7 +77,7 @@ public Action:SayCommand(client, argc)
return Plugin_Continue; return Plugin_Continue;
} }
bool:ZClass(client) /*bool:ZClass(client)
{ {
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]); new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (!classes) if (!classes)
@ -98,7 +98,7 @@ bool:ZClass(client)
ClassMenu(client); ClassMenu(client);
return true; return true;
} }*/
bool:ZMarket(client) bool:ZMarket(client)
{ {

View File

@ -114,9 +114,11 @@ WeaponsOnClientDisconnect(client)
*/ */
WeaponsCreateWeaponArray(&Handle:arrayWeapons, maxlen = WEAPONS_MAX_LENGTH) WeaponsCreateWeaponArray(&Handle:arrayWeapons, maxlen = WEAPONS_MAX_LENGTH)
{ {
// Initialize array handle.
arrayWeapons = CreateArray(maxlen); arrayWeapons = CreateArray(maxlen);
new count = 0; new count = 0;
// Reset keyvalue's traveral stack.
KvRewind(kvWeapons); KvRewind(kvWeapons);
if (KvGotoFirstSubKey(kvWeapons)) if (KvGotoFirstSubKey(kvWeapons))
{ {
@ -126,11 +128,15 @@ WeaponsCreateWeaponArray(&Handle:arrayWeapons, maxlen = WEAPONS_MAX_LENGTH)
{ {
KvGetSectionName(kvWeapons, weapon, maxlen); KvGetSectionName(kvWeapons, weapon, maxlen);
// Push weapon name into the array
PushArrayString(arrayWeapons, weapon); PushArrayString(arrayWeapons, weapon);
// Increment count.
count++; count++;
} while (KvGotoNextKey(kvWeapons)); } while (KvGotoNextKey(kvWeapons));
} }
// Return the count
return count; return count;
} }
@ -193,6 +199,7 @@ WeaponGetDisplayName(const String:weapon[], String:display[])
*/ */
bool:WeaponsIsWeaponMenu(const String:weapon[]) bool:WeaponsIsWeaponMenu(const String:weapon[])
{ {
// Reset keyvalue's traversal stack.
KvRewind(kvWeapons); KvRewind(kvWeapons);
if (KvGotoFirstSubKey(kvWeapons)) if (KvGotoFirstSubKey(kvWeapons))
{ {
@ -203,14 +210,44 @@ bool:WeaponsIsWeaponMenu(const String:weapon[])
{ {
KvGetSectionName(kvWeapons, validweapon, sizeof(validweapon)); KvGetSectionName(kvWeapons, validweapon, sizeof(validweapon));
// If this is the right weapon, then return setting for it.
if (StrEqual(validweapon, weapon, false)) if (StrEqual(validweapon, weapon, false))
{ {
KvGetString(kvWeapons, "menu", menu, sizeof(menu), "yes"); KvGetString(kvWeapons, "menu", menu, sizeof(menu), "yes");
// Return weapon's setting.
return ConfigSettingToBool(menu); return ConfigSettingToBool(menu);
} }
} while (KvGotoNextKey(kvWeapons)); } while (KvGotoNextKey(kvWeapons));
} }
return false; return false;
}
/**
* Returns knockback multiplier of the weapon
* @param weapon The weapon name.
* @return The float value of the knockback multiplier, 1.0 if not found.
*/
Float:WeaponGetWeaponKnockback(const String:weapon[])
{
// Reset keyvalue's traversal stack.
KvRewind(kvWeapons);
if (KvGotoFirstSubKey(kvWeapons))
{
decl String:validweapon[WEAPONS_MAX_LENGTH];
do
{
KvGetSectionName(kvWeapons, validweapon, sizeof(validweapon));
// If this is the right weapon, then return setting for it.
if (StrEqual(validweapon, weapon, false))
{
return KvGetFloat(kvWeapons, "knockback", 1.0);
}
} while (KvGotoNextKey(kvWeapons));
}
return 1.0;
} }

View File

@ -41,12 +41,12 @@ bool:ZRAdminMenu(client)
Format(weapons, sizeof(weapons), "%t", "!zadmin main weapons"); Format(weapons, sizeof(weapons), "%t", "!zadmin main weapons");
Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags"); Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags");
AddMenuItem(menu_zadmin, "knockbackm", knockbackm); AddMenuItem(menu_zadmin, "knockbackm", knockbackm, ITEMDRAW_DISABLED);
AddMenuItem(menu_zadmin, "knockback", knockback); AddMenuItem(menu_zadmin, "knockback", knockback, ITEMDRAW_DISABLED);
AddMenuItem(menu_zadmin, "nvgs", nvgs); AddMenuItem(menu_zadmin, "nvgs", nvgs, ITEMDRAW_DISABLED);
AddMenuItem(menu_zadmin, "infect", infect); AddMenuItem(menu_zadmin, "infect", infect);
AddMenuItem(menu_zadmin, "zspawn", zspawn); AddMenuItem(menu_zadmin, "zspawn", zspawn);
AddMenuItem(menu_zadmin, "ztele", ztele); AddMenuItem(menu_zadmin, "ztele", ztele, ITEMDRAW_DISABLED);
AddMenuItem(menu_zadmin, "weapons", weapons); AddMenuItem(menu_zadmin, "weapons", weapons);
AddMenuItem(menu_zadmin, "logflags", logflags); AddMenuItem(menu_zadmin, "logflags", logflags);
@ -65,15 +65,15 @@ public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot)
{ {
case 0: case 0:
{ {
ZRKnockbackMMenu(client); //ZRKnockbackMMenu(client);
} }
case 1: case 1:
{ {
ZRClassSelectMenu(client); //ZRClassSelectMenu(client);
} }
case 2: case 2:
{ {
ZRNVGSMenu(client); //ZRNVGSMenu(client);
} }
case 3: case 3:
{ {
@ -111,7 +111,10 @@ public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot)
} }
} }
ZRKnockbackMMenu(client) /**
* Needs to be recoded to support new modules.
*/
/*ZRKnockbackMMenu(client)
{ {
new Handle:menu_knockbackm = CreateMenu(ZRKnockbackMHandle); new Handle:menu_knockbackm = CreateMenu(ZRKnockbackMHandle);
new Float:curknockback = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]); new Float:curknockback = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
@ -351,7 +354,7 @@ public ZRNVGSHandle(Handle:menu_nvgs, MenuAction:action, client, slot)
{ {
CloseHandle(menu_nvgs); CloseHandle(menu_nvgs);
} }
} }*/
ZRInfectMenu(client) ZRInfectMenu(client)
{ {

View File

@ -162,11 +162,6 @@ public Action:MotherZombie(Handle:timer)
Zombify_Mother(client) Zombify_Mother(client)
{ {
Call_StartForward(hZombify);
Call_PushCell(client);
Call_PushCell(true);
Call_Finish();
gZombie[client] = true; gZombie[client] = true;
motherZombie[client] = true; motherZombie[client] = true;
@ -246,12 +241,6 @@ Zombify(client, attacker = -1, bool:motherinfect = false)
} }
} }
// Forward global event.
Call_StartForward(hZombify);
Call_PushCell(client);
Call_PushCell(false);
Call_Finish();
// Set player status. // Set player status.
gZombie[client] = true; gZombie[client] = true;
motherZombie[client] = motherinfect; motherZombie[client] = motherinfect;
@ -308,7 +297,6 @@ Zombify(client, attacker = -1, bool:motherinfect = false)
// Forward event to modules. // Forward event to modules.
ClassOnClientInfected(client); ClassOnClientInfected(client);
AbortTeleport(client); AbortTeleport(client);
AntiStick(attacker, client);
// Apply effects. // Apply effects.
InfectionEffects(client); InfectionEffects(client);
@ -390,32 +378,6 @@ InfectionEffects(client)
} }
} }
KnockBack(client, const Float:clientloc[3], const Float:attackerloc[3], Float:power, dmg, bool:grenade)
{
if (!IsPlayerZombie(client))
{
return;
}
new Float:vector[3];
MakeVectorFromPoints(attackerloc, clientloc, vector);
NormalizeVector(vector, vector);
vector[0] *= power * (float(dmg) * 1.5);
vector[1] *= power * (float(dmg) * 1.5);
vector[2] *= power * (float(dmg) * 1.5);
if (grenade)
{
new Float:knockback_grenade = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK_GRENADE]);
ScaleVector(vector, knockback_grenade);
}
SetPlayerVelocity(client, vector, false);
}
JumpBoost(client, Float:distance, Float:height) JumpBoost(client, Float:distance, Float:height)
{ {
new Float:vel[3]; new Float:vel[3];

View File

@ -76,9 +76,6 @@ new bool:dispHP[MAXPLAYERS + 1];
new bool:pProtect[MAXPLAYERS + 1]; new bool:pProtect[MAXPLAYERS + 1];
new bool:gKilledByWorld[MAXPLAYERS + 1] = {false, ...}; new bool:gKilledByWorld[MAXPLAYERS + 1] = {false, ...};
new pClass[MAXPLAYERS + 1];
new pNextClass[MAXPLAYERS + 1];
new pTimeLeft[MAXPLAYERS + 1]; new pTimeLeft[MAXPLAYERS + 1];
new Float:spawnLoc[MAXPLAYERS + 1][3]; new Float:spawnLoc[MAXPLAYERS + 1][3];