From ddf0515a9ee05a2e7ee37b43a3f48392ca9834bf Mon Sep 17 00:00:00 2001 From: Greyscale Date: Tue, 14 Apr 2009 22:05:20 +0200 Subject: [PATCH 1/2] Removed antistick nudge on infect, disabled zadmin menu items that are under construction, added knockback module, and weapon-specific knockback multipliers in weapons.txt --- .../sourcemod/configs/zr/weapons/weapons.txt | 36 +++- src/zombiereloaded.sp | 4 + src/zr/antistick.inc | 38 ---- src/zr/classes.inc | 2 +- src/zr/commands.inc | 3 +- src/zr/cvars.inc | 4 - src/zr/event.inc | 75 +------- src/zr/knockback.inc | 167 ++++++++++++++++++ src/zr/weapons/weapons.inc | 37 ++++ src/zr/zadmin.inc | 21 ++- src/zr/zombie.inc | 27 --- 11 files changed, 259 insertions(+), 155 deletions(-) create mode 100644 src/zr/knockback.inc diff --git a/cstrike/addons/sourcemod/configs/zr/weapons/weapons.txt b/cstrike/addons/sourcemod/configs/zr/weapons/weapons.txt index 568f068..806bd20 100644 --- a/cstrike/addons/sourcemod/configs/zr/weapons/weapons.txt +++ b/cstrike/addons/sourcemod/configs/zr/weapons/weapons.txt @@ -6,6 +6,7 @@ // { // "restrict" "no" (default) // Restricts the weapon on each map start // "menu" "yes" (default) // Allows admins to toggle restriction with the menu +// "knockback" "1.0" (default) // The knockback multiplier for the weapon // } // // Notes: @@ -24,164 +25,191 @@ { "Glock" { - //"restrict" "no" + "restrict" "no" "menu" "yes" + "knockback" "0.8" } "USP" { "restrict" "no" - //"menu" "yes" + "menu" "yes" + "knockback" "0.8" } "P228" { - //"restrict" "no" - //"menu" "yes" + "restrict" "no" + "menu" "yes" + "knockback" "1.0" } "Deagle" { "restrict" "no" "menu" "yes" + "knockback" "1.2" } "Elite" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "Fiveseven" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "M3" { "restrict" "no" "menu" "yes" + "knockback" "0.8" // Remember that there are 8 pellets in 1 shot. } "XM1014" { "restrict" "no" "menu" "yes" + "knockback" "0.8" // See above comment. } "Mac10" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "TMP" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "MP5Navy" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "UMP45" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "P90" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "Galil" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "Famas" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "AK47" { "restrict" "no" "menu" "yes" + "knockback" "1.2" } "M4A1" { "restrict" "no" "menu" "yes" + "knockback" "1.1" } "SG552" { "restrict" "no" "menu" "yes" + "knockback" "1.0" } "AUG" { "restrict" "no" "menu" "yes" + "knockback" "1.1" } "Scout" { "restrict" "no" "menu" "yes" + "knockback" "1.5" } "SG550" { "restrict" "yes" "menu" "yes" + "knockback" "1.3" } "G3SG1" { "restrict" "yes" "menu" "yes" + "knockback" "1.3" } "AWP" { "restrict" "yes" "menu" "yes" + "knockback" "1.8" } "M249" { "restrict" "yes" "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" diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index da1cbf7..376c80a 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -37,6 +37,9 @@ // Weapons #include "zr/weapons/weapons" +// Knockback +#include "zr/knockback" + #include "zr/zadmin" #include "zr/damagecontrol" #include "zr/commands" @@ -153,6 +156,7 @@ public OnConfigsExecuted() if (FileExists(path)) { ServerCommand("exec %s", mapconfig); + if (LogFlagCheck(LOG_CORE_EVENTS)) { LogMessage("Executed map config file: %s", mapconfig); diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index e6145ff..cc45098 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -47,44 +47,6 @@ AntiStickReset() 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 * diff --git a/src/zr/classes.inc b/src/zr/classes.inc index 4eacc18..8c625b1 100644 --- a/src/zr/classes.inc +++ b/src/zr/classes.inc @@ -96,7 +96,7 @@ LoadClassData() 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_knockback] = KvGetFloat(kvClasses, "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]); diff --git a/src/zr/commands.inc b/src/zr/commands.inc index 476ffec..95362f3 100644 --- a/src/zr/commands.inc +++ b/src/zr/commands.inc @@ -264,7 +264,8 @@ public Action:Command_KnockbackMMenu(client, argc) { if (IsClientPlayer(client)) { - ZRKnockbackMMenu(client); + // Disabled, under construction. + // ZRKnockbackMMenu(client); } else { diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 37d9fe7..7b29cc8 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -27,8 +27,6 @@ enum ZRSettings Handle:CVAR_ZOMBIE_SPEED, Handle:CVAR_ZOMBIE_JUMP_DISTANCE, Handle:CVAR_ZOMBIE_JUMP_HEIGHT, - Handle:CVAR_ZOMBIE_KNOCKBACK, - Handle:CVAR_ZOMBIE_KNOCKBACK_GRENADE, Handle:CVAR_ZOMBIE_NVGS, Handle:CVAR_ZOMBIE_FOV, 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_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_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_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"); diff --git a/src/zr/event.inc b/src/zr/event.inc index 65ea9d8..b25f7b3 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -252,11 +252,14 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) new index = GetClientOfUserId(GetEventInt(event, "userid")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); - new dmg = GetEventInt(event, "dmg_health"); + new dmg_health = GetEventInt(event, "dmg_health"); decl String:weapon[32]; GetEventString(event, "weapon", weapon, sizeof(weapon)); + // Forward event to modules. + KnockbackPlayerHurt(index, attacker, weapon, dmg_health); + // Check if the attacker is a player. if (attacker != 0) { @@ -269,41 +272,6 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) 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. @@ -337,41 +305,6 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast) 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) { new index = GetClientOfUserId(GetEventInt(event, "userid")); diff --git a/src/zr/knockback.inc b/src/zr/knockback.inc new file mode 100644 index 0000000..aebf089 --- /dev/null +++ b/src/zr/knockback.inc @@ -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; +} \ No newline at end of file diff --git a/src/zr/weapons/weapons.inc b/src/zr/weapons/weapons.inc index 75db19d..9bb1a9b 100644 --- a/src/zr/weapons/weapons.inc +++ b/src/zr/weapons/weapons.inc @@ -114,9 +114,11 @@ WeaponsOnClientDisconnect(client) */ WeaponsCreateWeaponArray(&Handle:arrayWeapons, maxlen = WEAPONS_MAX_LENGTH) { + // Initialize array handle. arrayWeapons = CreateArray(maxlen); new count = 0; + // Reset keyvalue's traveral stack. KvRewind(kvWeapons); if (KvGotoFirstSubKey(kvWeapons)) { @@ -126,11 +128,15 @@ WeaponsCreateWeaponArray(&Handle:arrayWeapons, maxlen = WEAPONS_MAX_LENGTH) { KvGetSectionName(kvWeapons, weapon, maxlen); + // Push weapon name into the array PushArrayString(arrayWeapons, weapon); + + // Increment count. count++; } while (KvGotoNextKey(kvWeapons)); } + // Return the count return count; } @@ -193,6 +199,7 @@ WeaponGetDisplayName(const String:weapon[], String:display[]) */ bool:WeaponsIsWeaponMenu(const String:weapon[]) { + // Reset keyvalue's traversal stack. KvRewind(kvWeapons); if (KvGotoFirstSubKey(kvWeapons)) { @@ -203,14 +210,44 @@ bool:WeaponsIsWeaponMenu(const String:weapon[]) { KvGetSectionName(kvWeapons, validweapon, sizeof(validweapon)); + // If this is the right weapon, then return setting for it. if (StrEqual(validweapon, weapon, false)) { KvGetString(kvWeapons, "menu", menu, sizeof(menu), "yes"); + // Return weapon's setting. return ConfigSettingToBool(menu); } } while (KvGotoNextKey(kvWeapons)); } 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; } \ No newline at end of file diff --git a/src/zr/zadmin.inc b/src/zr/zadmin.inc index 26a92c7..682aaf6 100644 --- a/src/zr/zadmin.inc +++ b/src/zr/zadmin.inc @@ -42,12 +42,12 @@ bool:ZRAdminMenu(client) Format(weapons, sizeof(weapons), "%t", "!zadmin main weapons"); Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags"); - AddMenuItem(menu_zadmin, "knockbackm", knockbackm); - AddMenuItem(menu_zadmin, "knockback", knockback); - AddMenuItem(menu_zadmin, "nvgs", nvgs); + AddMenuItem(menu_zadmin, "knockbackm", knockbackm, ITEMDRAW_DISABLED); + AddMenuItem(menu_zadmin, "knockback", knockback, ITEMDRAW_DISABLED); + AddMenuItem(menu_zadmin, "nvgs", nvgs, ITEMDRAW_DISABLED); AddMenuItem(menu_zadmin, "infect", infect); 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, "logflags", logflags); @@ -66,15 +66,15 @@ public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot) { case 0: { - ZRKnockbackMMenu(client); + //ZRKnockbackMMenu(client); } case 1: { - ZRClassSelectMenu(client); + //ZRClassSelectMenu(client); } case 2: { - ZRNVGSMenu(client); + //ZRNVGSMenu(client); } case 3: { @@ -112,7 +112,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 Float:curknockback = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]); @@ -352,7 +355,7 @@ public ZRNVGSHandle(Handle:menu_nvgs, MenuAction:action, client, slot) { CloseHandle(menu_nvgs); } -} +}*/ ZRInfectMenu(client) { diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index 205a94f..68d6f8f 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -308,7 +308,6 @@ Zombify(client, attacker = -1, bool:motherinfect = false) // Forward event to modules. ClassOnClientInfected(client); AbortTeleport(client); - AntiStick(attacker, client); // Apply effects. InfectionEffects(client); @@ -390,32 +389,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) { new Float:vel[3]; From 648a875c14c73905b7a28253688a16c0fe78fd67 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Tue, 14 Apr 2009 23:16:31 +0200 Subject: [PATCH 2/2] Removed old class system. Cleared out external API natives and forwards. Commented out old menus. --- src/include/zr.inc | 45 +-- src/zombiereloaded.sp | 14 +- src/zr/classes.inc | 392 ------------------------- src/zr/commands.inc | 17 +- src/zr/event.inc | 12 - src/zr/global.inc | 28 +- src/zr/menu.inc | 10 +- src/zr/playerclasses/classevents.inc | 22 +- src/zr/playerclasses/playerclasses.inc | 10 - src/zr/sayhooks.inc | 8 +- src/zr/zombie.inc | 11 - src/zr/zombiereloaded.inc | 3 - 12 files changed, 33 insertions(+), 539 deletions(-) delete mode 100644 src/zr/classes.inc diff --git a/src/include/zr.inc b/src/include/zr.inc index fa656b6..c85d222 100644 --- a/src/include/zr.inc +++ b/src/include/zr.inc @@ -1,42 +1,3 @@ -/** - * ==================== - * 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); \ No newline at end of file +// =============================== +// Zombie:Reloaded External API +// =============================== \ No newline at end of file diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 376c80a..f312008 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -23,7 +23,6 @@ #include "zr/translation" #include "zr/offsets" #include "zr/ambience" -#include "zr/classes" #include "zr/models" #include "zr/overlays" #include "zr/playerclasses/playerclasses" @@ -125,15 +124,8 @@ public OnMapStart() LoadModelData(); LoadDownloadData(); - - new i; - new classindex = GetDefaultClassIndex(); - for (i = 1; i <= MAXPLAYERS; i++) - { - pClass[i] = classindex; - } - // Forward event to modules. + ClassLoad(); WeaponsOnMapStart(); Anticamp_Startup(); } @@ -164,15 +156,11 @@ public OnConfigsExecuted() } FindMapSky(); - ClassLoad(); - LoadClassData(); LoadAmbienceData(); - } public OnClientPutInServer(client) { - pClass[client] = GetDefaultClassIndex(); gBlockMotherInfect[client] = false; gKilledByWorld[client] = false; diff --git a/src/zr/classes.inc b/src/zr/classes.inc deleted file mode 100644 index 8c625b1..0000000 --- a/src/zr/classes.inc +++ /dev/null @@ -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"); - 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]); -}*/ diff --git a/src/zr/commands.inc b/src/zr/commands.inc index 95362f3..9d4c68c 100644 --- a/src/zr/commands.inc +++ b/src/zr/commands.inc @@ -20,11 +20,11 @@ CreateCommands() RegAdminCmd("zr_restrict", Command_Restrict, ADMFLAG_GENERIC, "Restrict 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 "); - RegAdminCmd("zr_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback "); + //RegAdminCmd("zr_set_class_knockback", Command_SetClassKnockback, ADMFLAG_GENERIC, "Sets the knockback to the specified class. Usage: zr_set_class_knockback "); + //RegAdminCmd("zr_get_class_knockback", Command_GetClassKnockback, ADMFLAG_GENERIC, "Gets the knockback to the specified class. Usage: zr_get_class_knockback "); 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_anticamp_create_volume", Command_AnticampCreateVolume, ADMFLAG_GENERIC, "Creates a rectangular hurt volume between two points. Usage: ht_create_volume "); @@ -192,7 +192,7 @@ public Action:Command_Unrestrict(client, argc) return Plugin_Handled; } -public Action:Command_SetClassKnockback(client, argc) +/*public Action:Command_SetClassKnockback(client, argc) { if (argc < 2) { @@ -245,7 +245,7 @@ public Action:Command_GetClassKnockback(client, argc) ReplyToCommand(client, "Current knockback for %s: %f", classname, knockback); return Plugin_Handled; -} +}*/ public Action:Command_AdminMenu(client, argc) { @@ -255,7 +255,8 @@ public Action:Command_AdminMenu(client, argc) } 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; } @@ -269,7 +270,8 @@ public Action:Command_KnockbackMMenu(client, argc) } 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; } @@ -282,6 +284,7 @@ public Action:Command_TeleMenu(client, argc) } else { + // BAD! ReplyToCommand(client, "This menu cannot be used from the console."); } return Plugin_Handled; diff --git a/src/zr/event.inc b/src/zr/event.inc index b25f7b3..f66ae22 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -185,18 +185,6 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) // Remove night vision. NightVisionOn(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; if (zombieSpawned) diff --git a/src/zr/global.inc b/src/zr/global.inc index e29d3c9..b860b15 100644 --- a/src/zr/global.inc +++ b/src/zr/global.inc @@ -6,31 +6,9 @@ * ==================== */ -new Handle:hZombify = INVALID_HANDLE; -new Handle:hOnZClassChanged = INVALID_HANDLE; - +/** + * All external API natives are created here. + */ 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; } \ No newline at end of file diff --git a/src/zr/menu.inc b/src/zr/menu.inc index 011e1cb..e959935 100644 --- a/src/zr/menu.inc +++ b/src/zr/menu.inc @@ -24,7 +24,7 @@ MainMenu(client) Format(zmenu, sizeof(zmenu), "%t", "!zmenu menu"); 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(zspawn, sizeof(zspawn), "%t", "!zmenu spawn"); Format(ztele, sizeof(ztele), "%t", "!zmenu tele"); @@ -74,10 +74,10 @@ public MainMenuHandle(Handle:menu_main, MenuAction:action, client, slot) } case 2: { - if (!ZClass(client)) + /*if (!ZClass(client)) { MainMenu(client); - } + }*/ } 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); @@ -184,4 +184,4 @@ public ClassMenuHandle(Handle:menu_classes, MenuAction:action, client, slot) { CloseHandle(menu_classes); } -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/src/zr/playerclasses/classevents.inc b/src/zr/playerclasses/classevents.inc index eec43e9..9c0eb5b 100644 --- a/src/zr/playerclasses/classevents.inc +++ b/src/zr/playerclasses/classevents.inc @@ -45,35 +45,27 @@ ClassOnClientSpawn(client) if (showmenu && !randomclass) { - ClassMenu(client); + //ClassMenu(client); } // Assign random classes if enabled. GetClientAuthString(client, steamid, sizeof(steamid)); if (StrEqual(steamid, "BOT") || randomclass) { - // Old class system. - 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. + // Get player's team 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) { - classindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES); + new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_ZOMBIES); ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES] = classindex; ClassGetName(client, classname, sizeof(classname)); } else { - classindex = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS); + new classindex = ClassGetRandomClass(ZR_CLASS_TEAM_HUMANS); ClassSelected[client][ZR_CLASS_TEAM_HUMANS] = classindex; ClassGetName(client, classname, sizeof(classname)); } diff --git a/src/zr/playerclasses/playerclasses.inc b/src/zr/playerclasses/playerclasses.inc index b6a159a..92052cf 100644 --- a/src/zr/playerclasses/playerclasses.inc +++ b/src/zr/playerclasses/playerclasses.inc @@ -551,8 +551,6 @@ bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIF */ ClassClientSetDefaultIndexes(client = -1) { - new classindex = GetDefaultClassIndex(); // Old class system. Not removed for backwards compatibility. - // Get indexes. new zombieindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_ZOMBIES); new humanindex = ClassGetDefaultSpawnClass(ZR_CLASS_TEAM_HUMANS); @@ -603,10 +601,6 @@ ClassClientSetDefaultIndexes(client = -1) // Check if a client is specified. 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_HUMANS] = humanindex; ClassSelected[client][ZR_CLASS_TEAM_ADMINS] = adminindex; @@ -619,10 +613,6 @@ ClassClientSetDefaultIndexes(client = -1) // No client specified. Loop through all players. 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_HUMANS] = humanindex; ClassSelected[clientindex][ZR_CLASS_TEAM_ADMINS] = adminindex; diff --git a/src/zr/sayhooks.inc b/src/zr/sayhooks.inc index feb3801..bfd90a3 100644 --- a/src/zr/sayhooks.inc +++ b/src/zr/sayhooks.inc @@ -35,10 +35,10 @@ public Action:SayCommand(client, argc) ZRAdminMenu(client); } - else if (StrEqual(args, "!zclass", false)) + /*else if (StrEqual(args, "!zclass", false)) { ZClass(client); - } + }*/ else if (StrEqual(args, "!zmarket", false)) { @@ -77,7 +77,7 @@ public Action:SayCommand(client, argc) return Plugin_Continue; } -bool:ZClass(client) +/*bool:ZClass(client) { new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]); if (!classes) @@ -98,7 +98,7 @@ bool:ZClass(client) ClassMenu(client); return true; -} +}*/ bool:ZMarket(client) { diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index 68d6f8f..27f5cb5 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -162,11 +162,6 @@ public Action:MotherZombie(Handle:timer) Zombify_Mother(client) { - Call_StartForward(hZombify); - Call_PushCell(client); - Call_PushCell(true); - Call_Finish(); - gZombie[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. gZombie[client] = true; motherZombie[client] = motherinfect; diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index aa9c2ca..e01e91c 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -76,9 +76,6 @@ new bool:dispHP[MAXPLAYERS + 1]; new bool:pProtect[MAXPLAYERS + 1]; new bool:gKilledByWorld[MAXPLAYERS + 1] = {false, ...}; -new pClass[MAXPLAYERS + 1]; -new pNextClass[MAXPLAYERS + 1]; - new pTimeLeft[MAXPLAYERS + 1]; new Float:spawnLoc[MAXPLAYERS + 1][3];