Merged heads.

This commit is contained in:
richard 2009-07-24 00:44:02 +02:00
commit 5be8ef80e8
9 changed files with 48 additions and 27 deletions

View File

@ -984,6 +984,11 @@
"en" "Human/Zombie Class Overlay: {1}" "en" "Human/Zombie Class Overlay: {1}"
} }
"ZCookies zmarket loadout"
{
"en" "ZMarket Loadout"
}
// =========================== // ===========================
// ZSpawn (module) // ZSpawn (module)
// =========================== // ===========================

View File

@ -336,8 +336,8 @@ zr_damage_suicide_mzombie "1"
zr_damage_suicide_human "0" zr_damage_suicide_human "0"
// List of client commands to intercept as suicide attempts. [Delimiter: ", "] // List of client commands to intercept as suicide attempts. [Delimiter: ", "]
// Default: "kill, spectate, jointeam" // Default: "kill, spectate, jointeam, joinclass"
zr_damage_suicide_cmds "kill, spectate, jointeam" zr_damage_suicide_cmds "kill, spectate, jointeam, joinclass"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -28,9 +28,6 @@
/** /**
* @section Collision values. * @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_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 1 /** Collides with nothing but world and static stuff. */
#define COLLISION_GROUP_DEBRIS_TRIGGER 2 /** Same as debris, but hits triggers. */ #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_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_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 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 * @endsection
*/ */
@ -306,26 +306,18 @@ public ZRTools_Action:AntiStickStartTouch(client, entity)
// Get current collision groups of client and entity. // Get current collision groups of client and entity.
new clientcollisiongroup = AntiStickGetCollisionGroup(client); new clientcollisiongroup = AntiStickGetCollisionGroup(client);
new entitycollisiongroup = AntiStickGetCollisionGroup(entity);
// Note: If zombies get stuck on infection or stuck in a teleport, they'll // Note: If zombies get stuck on infection or stuck in a teleport, they'll
// get the COLLISION_GROUP_PUSHAWAY collision group, so check this // get the COLLISION_GROUP_PUSHAWAY collision group, so check this
// one too. // one too.
// Check if the client have collisions enabled, or have the pushaway collision group. // If the client is in any other collision group than "off", than we must set them to off, to unstick.
if (clientcollisiongroup == ANTISTICK_COLLISIONS_ON || clientcollisiongroup == COLLISION_GROUP_PUSHAWAY) if (clientcollisiongroup != ANTISTICK_COLLISIONS_OFF)
{ {
// Disable collisions to unstick, and start timers to re-solidify. // Disable collisions to unstick, and start timers to re-solidify.
AntiStickSetCollisionGroup(client, ANTISTICK_COLLISIONS_OFF); AntiStickSetCollisionGroup(client, ANTISTICK_COLLISIONS_OFF);
CreateTimer(0.0, AntiStickSolidifyTimer, client, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT); 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);
}
} }
/** /**

View File

@ -314,7 +314,7 @@ CvarsCreate()
g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE] = CreateConVar("zr_damage_suicide_zombie", "0", "Intercept suicide commands attempted by zombies."); 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_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_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_CMDS] = CreateConVar("zr_damage_suicide_cmds", "kill, spectate, jointeam, joinclass", "List of client commands to intercept as suicide attempts. [Delimiter: \", \"]");
// =========================== // ===========================

View File

@ -66,12 +66,15 @@ DamageOnCommandsHook()
new String:arrayCmds[DAMAGE_SUICIDE_MAX_CMDS][DAMAGE_SUICIDE_MAX_LENGTH]; new String:arrayCmds[DAMAGE_SUICIDE_MAX_CMDS][DAMAGE_SUICIDE_MAX_LENGTH];
// Explode string into array indexes. // 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. // x = Array index.
// arrayCmds[x] = suicide command. // arrayCmds[x] = suicide command.
for (new x = 0; x <= cmdcount - 1; x++) for (new x = 0; x <= cmdcount - 1; x++)
{ {
// Trim whitespace.
TrimString(arrayCmds[x]);
// Prepare intercept for this command. // Prepare intercept for this command.
RegConsoleCmd(arrayCmds[x], DamageSuicideIntercept); RegConsoleCmd(arrayCmds[x], DamageSuicideIntercept);
} }

View File

@ -96,7 +96,7 @@ ModelsLoad()
ModelReturnPath(x, modelbase, sizeof(modelbase)); ModelReturnPath(x, modelbase, sizeof(modelbase));
// Explode path into pieces. (separated by "/") // 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. // Get model file name.
strcopy(modelname, sizeof(modelname), baseexploded[strings - 1]); strcopy(modelname, sizeof(modelname), baseexploded[strings - 1]);

View File

@ -57,12 +57,15 @@ ClassOverlayOnCommandsHook()
new String:arrayCmds[CLASSOVERLAY_TOGGLE_MAX_CMDS][CLASSOVERLAY_TOGGLE_MAX_LENGTH]; new String:arrayCmds[CLASSOVERLAY_TOGGLE_MAX_CMDS][CLASSOVERLAY_TOGGLE_MAX_LENGTH];
// Explode string into array indexes. // 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. // x = Array index.
// arrayCmds[x] = suicide command. // arrayCmds[x] = suicide command.
for (new x = 0; x <= cmdcount - 1; x++) for (new x = 0; x <= cmdcount - 1; x++)
{ {
// Trim whitespace.
TrimString(arrayCmds[x]);
// Prepare intercept for this command. // Prepare intercept for this command.
RegConsoleCmd(arrayCmds[x], ClassOverlayEnableCommand); RegConsoleCmd(arrayCmds[x], ClassOverlayEnableCommand);
} }

View File

@ -98,7 +98,7 @@ RestrictLoad()
{ {
WeaponsGetType(x, weapontype, sizeof(weapontype)); 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++) for (new y = 0; y < WEAPONS_RESTRICT_MAX_TYPES; y++)
{ {
// Cut off whitespace. // Cut off whitespace.
@ -498,7 +498,7 @@ stock RestrictGetTypeWeapons(index, &Handle:arrayTypeWeapons)
{ {
WeaponsGetType(x, weapontype, sizeof(weapontype)); 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++) for (new y = 0; y < WEAPONS_RESTRICT_MAX_TYPES; y++)
{ {
// Cut off whitespace. // Cut off whitespace.

View File

@ -62,22 +62,26 @@ ZCookiesMenuMain(client)
decl String:autorebuy[64]; decl String:autorebuy[64];
decl String:zhp[64]; decl String:zhp[64];
decl String:overlay[64]; decl String:overlay[64];
decl String:zmarket[64];
// Translate each line into client's language. // Translate each line into client's language.
Format(autorebuy, sizeof(autorebuy), "%t", "ZCookies menu main auto-rebuy", autorebuyenabled); Format(autorebuy, sizeof(autorebuy), "%t", "ZCookies menu main auto-rebuy", autorebuyenabled);
Format(zhp, sizeof(zhp), "%t", "ZCookies menu main zhp", zhpenabled); Format(zhp, sizeof(zhp), "%t", "ZCookies menu main zhp", zhpenabled);
Format(overlay, sizeof(overlay), "%t", "ZCookies menu main overlay", overlayenabled); Format(overlay, sizeof(overlay), "%t", "ZCookies menu main overlay", overlayenabled);
Format(zmarket, sizeof(zmarket), "%t", "ZCookies zmarket loadout");
// Get conditional values for each option. // Get conditional values for each option.
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]); // For auto-rebuy. 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: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: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. // Add items to menu.
AddMenuItem(zcookies_menu_main, "autorebuy", autorebuy, MenuGetItemDraw(weapons && zmarketrebuyauto)); AddMenuItem(zcookies_menu_main, "autorebuy", autorebuy, MenuGetItemDraw(weapons && zmarketrebuyauto));
AddMenuItem(zcookies_menu_main, "zhp", zhp, MenuGetItemDraw(zhpcvar)); AddMenuItem(zcookies_menu_main, "zhp", zhp, MenuGetItemDraw(zhpcvar));
AddMenuItem(zcookies_menu_main, "overlay", overlay, MenuGetItemDraw(overlaytoggle)); AddMenuItem(zcookies_menu_main, "overlay", overlay, MenuGetItemDraw(overlaytoggle));
AddMenuItem(zcookies_menu_main, "zmarket", zmarket, MenuGetItemDraw(zmarketenabled));
// Create a "Back" button to the main menu. // Create a "Back" button to the main menu.
SetMenuExitBackButton(zcookies_menu_main, true); SetMenuExitBackButton(zcookies_menu_main, true);
@ -100,6 +104,8 @@ public ZCookiesMenuMainHandle(Handle:menu, MenuAction:action, client, slot)
// Client selected an option. // Client selected an option.
if (action == MenuAction_Select) if (action == MenuAction_Select)
{ {
new bool:resend = true;
switch(slot) switch(slot)
{ {
// Toggled auto-rebuy // Toggled auto-rebuy
@ -125,11 +131,23 @@ public ZCookiesMenuMainHandle(Handle:menu, MenuAction:action, client, slot)
CookiesSetClientCookieBool(client, g_hOverlayEnabledCookie, overlayenabled); CookiesSetClientCookieBool(client, g_hOverlayEnabledCookie, overlayenabled);
} }
} }
// Opened ZMarket loadout.
case 3:
{
// Show a client their current loadout.
ZMarketMenuLoadout(client);
// Don't resend ZCookies.
resend = false;
}
} }
if (resend)
{
// Re-send menu. // Re-send menu.
ZCookiesMenuMain(client); ZCookiesMenuMain(client);
} }
}
// Client closed the menu. // Client closed the menu.
if (action == MenuAction_Cancel) if (action == MenuAction_Cancel)
{ {