Imported fix from dev: 646:25e5741ab71e - Moved the IsClientInBuyzone stock to the weapons module from ZMarket, and stop the "Zombies can't use weapons" phrase when using autobuy outside of a buyzone.
This commit is contained in:
parent
05895df252
commit
b39a684fd8
@ -155,6 +155,12 @@ ClassOverlayInitialize(client, const String:overlay[])
|
|||||||
*/
|
*/
|
||||||
public Action:ClassOverlayEnableCommand(client, argc)
|
public Action:ClassOverlayEnableCommand(client, argc)
|
||||||
{
|
{
|
||||||
|
// If client isn't valid, then stop.
|
||||||
|
if (!ZRIsClientValid(client))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If overlay toggle is disabled, then stop.
|
// If overlay toggle is disabled, then stop.
|
||||||
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
|
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]);
|
||||||
if (!overlaytoggle)
|
if (!overlaytoggle)
|
||||||
|
@ -246,8 +246,14 @@ RestrictOnRoundEnd()
|
|||||||
*/
|
*/
|
||||||
public Action:RestrictBuyCommand(client, argc)
|
public Action:RestrictBuyCommand(client, argc)
|
||||||
{
|
{
|
||||||
// If client isn't in-game, then stop.
|
// If client isn't valid, then stop.
|
||||||
if (!IsClientInGame(client))
|
if (!ZRIsClientValid(client))
|
||||||
|
{
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the client isn't in a buyzone, then stop.
|
||||||
|
if (!WeaponsIsClientInBuyZone(client))
|
||||||
{
|
{
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
@ -127,9 +127,15 @@ WeaponsOnOffsetsFound()
|
|||||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Weapons, "Offsets", "Offset \"CBasePlayer::m_hActiveWeapon\" was not found.");
|
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Weapons, "Offsets", "Offset \"CBasePlayer::m_hActiveWeapon\" was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If offset "m_bInBuyZone" can't be found, then stop the plugin.
|
||||||
|
g_iToolsInBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone");
|
||||||
|
if (g_iToolsInBuyZone == -1)
|
||||||
|
{
|
||||||
|
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Weapons, "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.");
|
||||||
|
}
|
||||||
|
|
||||||
// Forward event to sub-modules
|
// Forward event to sub-modules
|
||||||
WeaponAmmoOnOffsetsFound();
|
WeaponAmmoOnOffsetsFound();
|
||||||
ZMarketOnOffsetsFound();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -906,3 +912,14 @@ stock WeaponsRefreshAllClientWeapons(client)
|
|||||||
WeaponsRefreshClientWeapon(client, WeaponsSlot:x);
|
WeaponsRefreshClientWeapon(client, WeaponsSlot:x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a client is in a buyzone.
|
||||||
|
*
|
||||||
|
* @param client The client index.
|
||||||
|
*/
|
||||||
|
stock bool:WeaponsIsClientInBuyZone(client)
|
||||||
|
{
|
||||||
|
// Return if client is in buyzone.
|
||||||
|
return bool:GetEntData(client, g_iToolsInBuyZone);
|
||||||
|
}
|
||||||
|
@ -94,19 +94,6 @@ ZMarketOnCookiesCreate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Find ZMarket-specific offsets here.
|
|
||||||
*/
|
|
||||||
ZMarketOnOffsetsFound()
|
|
||||||
{
|
|
||||||
// If offset "m_bInBuyZone" can't be found, then stop the plugin.
|
|
||||||
g_iToolsInBuyZone = FindSendPropInfo("CCSPlayer", "m_bInBuyZone");
|
|
||||||
if (g_iToolsInBuyZone == -1)
|
|
||||||
{
|
|
||||||
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Weapons, "Offsets", "Offset \"CCSPlayer::m_bInBuyZone\" was not found.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client is joining the server.
|
* Client is joining the server.
|
||||||
*
|
*
|
||||||
@ -786,7 +773,7 @@ stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
new bool:zmarketbuyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
new bool:zmarketbuyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
||||||
if (!rebuy && zmarketbuyzone && !ZMarketIsClientInBuyZone(client))
|
if (!rebuy && zmarketbuyzone && !WeaponsIsClientInBuyZone(client))
|
||||||
{
|
{
|
||||||
// Update cookie with new weapon.
|
// Update cookie with new weapon.
|
||||||
ZMarketSetRebuyCookie(client, slot, weapon);
|
ZMarketSetRebuyCookie(client, slot, weapon);
|
||||||
@ -1089,7 +1076,7 @@ ZMarketRebuy(client, bool:autorebuy = false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
new bool:zmarketbuyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
new bool:zmarketbuyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
||||||
if (!autorebuy && zmarketbuyzone && !ZMarketIsClientInBuyZone(client))
|
if (!autorebuy && zmarketbuyzone && !WeaponsIsClientInBuyZone(client))
|
||||||
{
|
{
|
||||||
TranslationPrintToChat(client, "Weapons zmarket buyzone");
|
TranslationPrintToChat(client, "Weapons zmarket buyzone");
|
||||||
return;
|
return;
|
||||||
@ -1166,14 +1153,3 @@ public Action:ZMarketCommand(client, argc)
|
|||||||
// This stops the "Unknown command" message in client's console.
|
// This stops the "Unknown command" message in client's console.
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a client is in a buyzone.
|
|
||||||
*
|
|
||||||
* @param client The client index.
|
|
||||||
*/
|
|
||||||
stock bool:ZMarketIsClientInBuyZone(client)
|
|
||||||
{
|
|
||||||
// Return if client is in buyzone.
|
|
||||||
return bool:GetEntData(client, g_iToolsInBuyZone);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user