diff --git a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt index 0313d53..6b34eca 100644 --- a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt +++ b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt @@ -984,6 +984,11 @@ "en" "Human/Zombie Class Overlay: {1}" } + "ZCookies zmarket loadout" + { + "en" "ZMarket Loadout" + } + // =========================== // ZSpawn (module) // =========================== diff --git a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg index 19130a4..fa73914 100644 --- a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg +++ b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg @@ -336,8 +336,8 @@ zr_damage_suicide_mzombie "1" zr_damage_suicide_human "0" // List of client commands to intercept as suicide attempts. [Delimiter: ", "] -// Default: "kill, spectate, jointeam" -zr_damage_suicide_cmds "kill, spectate, jointeam" +// Default: "kill, spectate, jointeam, joinclass" +zr_damage_suicide_cmds "kill, spectate, jointeam, joinclass" // ---------------------------------------------------------------------------- diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index 2427424..7963972 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -28,9 +28,6 @@ /** * @section Collision values. */ -#define ANTISTICK_COLLISIONS_OFF 2 -#define ANTISTICK_COLLISIONS_ON 5 - #define COLLISION_GROUP_NONE 0 /** Default; collides with static and dynamic objects. */ #define COLLISION_GROUP_DEBRIS 1 /** Collides with nothing but world and static stuff. */ #define COLLISION_GROUP_DEBRIS_TRIGGER 2 /** Same as debris, but hits triggers. */ @@ -50,6 +47,9 @@ #define COLLISION_GROUP_DISSOLVING 16 /** Things that are dissolving are in this group. */ #define COLLISION_GROUP_PUSHAWAY 17 /** Nonsolid on client and server, pushaway in player code. */ #define COLLISION_GROUP_NPC_ACTOR 18 /** Used so NPCs in scripts ignore the player. */ + +#define ANTISTICK_COLLISIONS_OFF COLLISION_GROUP_DEBRIS_TRIGGER +#define ANTISTICK_COLLISIONS_ON COLLISION_GROUP_PLAYER /** * @endsection */ @@ -306,26 +306,18 @@ public ZRTools_Action:AntiStickStartTouch(client, entity) // Get current collision groups of client and entity. new clientcollisiongroup = AntiStickGetCollisionGroup(client); - new entitycollisiongroup = AntiStickGetCollisionGroup(entity); // Note: If zombies get stuck on infection or stuck in a teleport, they'll // get the COLLISION_GROUP_PUSHAWAY collision group, so check this // one too. - // Check if the client have collisions enabled, or have the pushaway collision group. - if (clientcollisiongroup == ANTISTICK_COLLISIONS_ON || clientcollisiongroup == COLLISION_GROUP_PUSHAWAY) + // If the client is in any other collision group than "off", than we must set them to off, to unstick. + if (clientcollisiongroup != ANTISTICK_COLLISIONS_OFF) { // Disable collisions to unstick, and start timers to re-solidify. AntiStickSetCollisionGroup(client, ANTISTICK_COLLISIONS_OFF); CreateTimer(0.0, AntiStickSolidifyTimer, client, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT); } - - // Check if the entity have collisions enabled, or have the pushaway collision group. - if (entitycollisiongroup == ANTISTICK_COLLISIONS_ON || entitycollisiongroup == COLLISION_GROUP_PUSHAWAY) - { - AntiStickSetCollisionGroup(entity, ANTISTICK_COLLISIONS_OFF); - CreateTimer(0.0, AntiStickSolidifyTimer, entity, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT); - } } /** diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index dc1b6b1..8773f98 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -311,10 +311,10 @@ CvarsCreate() g_hCvarsList[CVAR_DAMAGE_BLOCK_BLAST] = CreateConVar("zr_damage_block_blast", "1", "Block blast damage inflicted on self or teammates."); // Suicide Intercept - g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE] = CreateConVar("zr_damage_suicide_zombie", "0", "Intercept suicide commands attempted by zombies."); - g_hCvarsList[CVAR_DAMAGE_SUICIDE_MZOMBIE] = CreateConVar("zr_damage_suicide_mzombie", "1", "Intercept suicide commands attempted by mother zombies."); - g_hCvarsList[CVAR_DAMAGE_SUICIDE_HUMAN] = CreateConVar("zr_damage_suicide_human", "0", "Intercept suicide commands attempted by humans."); - g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS] = CreateConVar("zr_damage_suicide_cmds", "kill, spectate, jointeam", "List of client commands to intercept as suicide attempts. [Delimiter: \", \"]"); + g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE] = CreateConVar("zr_damage_suicide_zombie", "0", "Intercept suicide commands attempted by zombies."); + g_hCvarsList[CVAR_DAMAGE_SUICIDE_MZOMBIE] = CreateConVar("zr_damage_suicide_mzombie", "1", "Intercept suicide commands attempted by mother zombies."); + g_hCvarsList[CVAR_DAMAGE_SUICIDE_HUMAN] = CreateConVar("zr_damage_suicide_human", "0", "Intercept suicide commands attempted by humans."); + g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS] = CreateConVar("zr_damage_suicide_cmds", "kill, spectate, jointeam, joinclass", "List of client commands to intercept as suicide attempts. [Delimiter: \", \"]"); // =========================== diff --git a/src/zr/damage.inc b/src/zr/damage.inc index e69a5df..008a218 100644 --- a/src/zr/damage.inc +++ b/src/zr/damage.inc @@ -66,12 +66,15 @@ DamageOnCommandsHook() new String:arrayCmds[DAMAGE_SUICIDE_MAX_CMDS][DAMAGE_SUICIDE_MAX_LENGTH]; // Explode string into array indexes. - new cmdcount = ExplodeString(suicidecmds, ", ", arrayCmds, DAMAGE_SUICIDE_MAX_CMDS, DAMAGE_SUICIDE_MAX_LENGTH); + new cmdcount = ExplodeString(suicidecmds, ",", arrayCmds, sizeof(arrayCmds), sizeof(arrayCmds[])); // x = Array index. // arrayCmds[x] = suicide command. for (new x = 0; x <= cmdcount - 1; x++) { + // Trim whitespace. + TrimString(arrayCmds[x]); + // Prepare intercept for this command. RegConsoleCmd(arrayCmds[x], DamageSuicideIntercept); } diff --git a/src/zr/models.inc b/src/zr/models.inc index 44389f4..1386157 100644 --- a/src/zr/models.inc +++ b/src/zr/models.inc @@ -96,7 +96,7 @@ ModelsLoad() ModelReturnPath(x, modelbase, sizeof(modelbase)); // Explode path into pieces. (separated by "/") - new strings = ExplodeString(modelbase, "/", baseexploded, MODELS_PATH_MAX_DEPTH, MODELS_PATH_DIR_MAX_LENGTH); + new strings = ExplodeString(modelbase, "/", baseexploded, sizeof(baseexploded), sizeof(baseexploded[])); // Get model file name. strcopy(modelname, sizeof(modelname), baseexploded[strings - 1]); diff --git a/src/zr/playerclasses/clientoverlays.inc b/src/zr/playerclasses/clientoverlays.inc index b34baec..687eaed 100644 --- a/src/zr/playerclasses/clientoverlays.inc +++ b/src/zr/playerclasses/clientoverlays.inc @@ -57,12 +57,15 @@ ClassOverlayOnCommandsHook() new String:arrayCmds[CLASSOVERLAY_TOGGLE_MAX_CMDS][CLASSOVERLAY_TOGGLE_MAX_LENGTH]; // Explode string into array indexes. - new cmdcount = ExplodeString(togglecmds, ", ", arrayCmds, CLASSOVERLAY_TOGGLE_MAX_CMDS, CLASSOVERLAY_TOGGLE_MAX_LENGTH); + new cmdcount = ExplodeString(togglecmds, ",", arrayCmds, sizeof(arrayCmds), sizeof(arrayCmds[])); // x = Array index. // arrayCmds[x] = suicide command. for (new x = 0; x <= cmdcount - 1; x++) { + // Trim whitespace. + TrimString(arrayCmds[x]); + // Prepare intercept for this command. RegConsoleCmd(arrayCmds[x], ClassOverlayEnableCommand); } diff --git a/src/zr/weapons/restrict.inc b/src/zr/weapons/restrict.inc index d4196f8..60146e1 100644 --- a/src/zr/weapons/restrict.inc +++ b/src/zr/weapons/restrict.inc @@ -98,7 +98,7 @@ RestrictLoad() { WeaponsGetType(x, weapontype, sizeof(weapontype)); - ExplodeString(weapontype, ",", weapontypes, WEAPONS_RESTRICT_MAX_TYPES, WEAPONS_MAX_LENGTH); + ExplodeString(weapontype, ",", weapontypes, sizeof(weapontypes), sizeof(weapontypes[])); for (new y = 0; y < WEAPONS_RESTRICT_MAX_TYPES; y++) { // Cut off whitespace. @@ -498,7 +498,7 @@ stock RestrictGetTypeWeapons(index, &Handle:arrayTypeWeapons) { WeaponsGetType(x, weapontype, sizeof(weapontype)); - ExplodeString(weapontype, ",", weapontypes, WEAPONS_RESTRICT_MAX_TYPES, WEAPONS_MAX_LENGTH); + ExplodeString(weapontype, ",", weapontypes, sizeof(weapontypes), sizeof(weapontypes[])); for (new y = 0; y < WEAPONS_RESTRICT_MAX_TYPES; y++) { // Cut off whitespace. diff --git a/src/zr/zcookies.inc b/src/zr/zcookies.inc index 930ad28..78d3e55 100644 --- a/src/zr/zcookies.inc +++ b/src/zr/zcookies.inc @@ -62,22 +62,26 @@ ZCookiesMenuMain(client) decl String:autorebuy[64]; decl String:zhp[64]; decl String:overlay[64]; + decl String:zmarket[64]; // Translate each line into client's language. Format(autorebuy, sizeof(autorebuy), "%t", "ZCookies menu main auto-rebuy", autorebuyenabled); Format(zhp, sizeof(zhp), "%t", "ZCookies menu main zhp", zhpenabled); Format(overlay, sizeof(overlay), "%t", "ZCookies menu main overlay", overlayenabled); + Format(zmarket, sizeof(zmarket), "%t", "ZCookies zmarket loadout"); // Get conditional values for each option. new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]); // For auto-rebuy. new bool:zmarketrebuyauto = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY_AUTO]); // For auto-rebuy. - new bool:zhpcvar = GetConVarBool(g_hCvarsList[CVAR_ZHP]); // For ZHP. + new bool:zhpcvar = GetConVarBool(g_hCvarsList[CVAR_ZHP]); // For ZHP. new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]); // For class overlay. + new bool:zmarketenabled = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET]); // For ZMarket loadout. // Add items to menu. AddMenuItem(zcookies_menu_main, "autorebuy", autorebuy, MenuGetItemDraw(weapons && zmarketrebuyauto)); AddMenuItem(zcookies_menu_main, "zhp", zhp, MenuGetItemDraw(zhpcvar)); AddMenuItem(zcookies_menu_main, "overlay", overlay, MenuGetItemDraw(overlaytoggle)); + AddMenuItem(zcookies_menu_main, "zmarket", zmarket, MenuGetItemDraw(zmarketenabled)); // Create a "Back" button to the main menu. SetMenuExitBackButton(zcookies_menu_main, true); @@ -100,6 +104,8 @@ public ZCookiesMenuMainHandle(Handle:menu, MenuAction:action, client, slot) // Client selected an option. if (action == MenuAction_Select) { + new bool:resend = true; + switch(slot) { // Toggled auto-rebuy @@ -125,10 +131,22 @@ public ZCookiesMenuMainHandle(Handle:menu, MenuAction:action, client, slot) CookiesSetClientCookieBool(client, g_hOverlayEnabledCookie, overlayenabled); } } + // Opened ZMarket loadout. + case 3: + { + // Show a client their current loadout. + ZMarketMenuLoadout(client); + + // Don't resend ZCookies. + resend = false; + } } - // Re-send menu. - ZCookiesMenuMain(client); + if (resend) + { + // Re-send menu. + ZCookiesMenuMain(client); + } } // Client closed the menu. if (action == MenuAction_Cancel)