This commit is contained in:
test
2009-04-29 01:58:41 +02:00
parent abd38ee033
commit fd129e561b
28 changed files with 1065 additions and 490 deletions

View File

@ -39,7 +39,7 @@ bool:ZMarketSend(client)
// Check buyzone cvar to see if client has to be in a buyzone to use.
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
if (!IsClientInBuyZone(client) && buyzone)
if (!ZMarketIsClientInBuyZone(client) && buyzone)
{
// Tell client they must be in a buyzone.
ZR_PrintCenterText(client, "Market out of buyzone");
@ -63,6 +63,17 @@ bool:ZMarketSend(client)
return true;
}
/**
* Checks if a client is in a buyzone.
*
* @param client The client index.
*/
bool:ZMarketIsClientInBuyZone(client)
{
// Return if client is in buyzone.
return bool:GetEntData(client, g_iToolsInBuyZone);
}
/**
* (Market) Forward called when a client selects a weapon from the market.
*
@ -115,7 +126,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
// Check if buyzone cvar is enabled, and if the client is in a buyzone.
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
if (!IsClientInBuyZone(client) && buyzone)
if (!ZMarketIsClientInBuyZone(client) && buyzone)
{
ZR_PrintCenterText(client, "Market out of buyzone");

View File

@ -847,30 +847,30 @@ RestrictGetGroupWeapons(const String:groupname[], String:weaponlist[], maxlen, c
*/
public RestrictCanUse(client, weapon, dummy1, dummy2, dummy3, dummy4)
{
// If plugin is disabled then stop.
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (!enabled)
{
return Hacks_Continue;
}
new String:weaponname[WEAPONS_MAX_LENGTH];
GetEdictClassname(weapon, weaponname, sizeof(weaponname));
// Strip "weapon_" from entity name.
ReplaceString(weaponname, sizeof(weaponname), "weapon_", "");
// If the weapon is restricted then prevent pickup.
// If weapon is a knife, then allow pickup.
if (StrEqual(weaponname, "knife"))
{
return Hacks_Continue;
}
// If the weapon is restricted, then prevent pickup.
if (RestrictIsWeaponRestricted(weaponname))
{
return 0;
}
// If the player is a zombie and the weapon isn't a knife then prevent pickup.
if (InfectIsClientInfected(client) && !StrEqual(weaponname, "knife"))
// If the player is a zombie, then prevent pickup.
if (InfectIsClientInfected(client))
{
return 0;
}
// Allow pickup.
return Hacks_Continue;
}

View File

@ -369,5 +369,5 @@ WeaponsType:WeaponsGetDeployedWeaponSlot(client)
WeaponForceClientDrop(client, weapon)
{
// Force client to drop weapon.
SDKCall(g_hCSWeaponDrop, client, weapon, true, false);
SDKCall(g_hToolsCSWeaponDrop, client, weapon, true, false);
}