Merged heads. Fixed conflicts in zadmin.inc.

This commit is contained in:
richard
2009-06-18 02:15:42 +02:00
29 changed files with 848 additions and 316 deletions

View File

@ -69,7 +69,7 @@ WeaponAlphaOnClientDisconnect(client)
/**
* The round is starting.
*/
WeaponAlphaOnRoundStart()
WeaponAlphaOnRoundStartPost()
{
// Allow weapon render mode to be modified.
g_bWeaponAlpha = true;

View File

@ -118,6 +118,7 @@ WeaponsOnCommandsCreate()
{
// Forward event to sub-modules.
RestrictOnCommandsCreate();
ZMarketOnCommandsCreate();
}
/**
@ -308,10 +309,10 @@ WeaponsOnClientSpawn(client)
/**
* The round is starting.
*/
WeaponsOnRoundStart()
WeaponsOnRoundStartPost()
{
// Forward event to sub-modules
WeaponAlphaOnRoundStart();
WeaponAlphaOnRoundStartPost();
}
/**

View File

@ -25,22 +25,6 @@
* ============================================================================
*/
/* * Copyright (C) 2009 Greyscale, Richard Helgeby
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
/**
* Variable to store buyzone offset value.
*/
@ -67,10 +51,12 @@ new String:g_strZMarketLastWeapon[MAXPLAYERS + 1][WeaponsSlot][WEAPONS_MAX_LENGT
new bool:g_bZMarketAutoRebuy[MAXPLAYERS + 1];
/**
* Initialize market data.
* Create commands specific to ZMarket.
*/
ZMarketInit()
ZMarketOnCommandsCreate()
{
// Register ZMarket command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZMARKET, ZMarketCommand, "Opens custom buymenu.");
}
/**
@ -114,7 +100,12 @@ ZMarketClientInit(client)
ZMarketOnClientDisconnect(client)
{
// Destroy ZMarket array data for client.
CloseHandle(g_hZMarketPurchaseCount[client]);
if (g_hZMarketPurchaseCount[client] != INVALID_HANDLE)
{
CloseHandle(g_hZMarketPurchaseCount[client]);
}
// Reset handle.
g_hZMarketPurchaseCount[client] = INVALID_HANDLE;
}
@ -131,7 +122,7 @@ ZMarketOnClientSpawn(client)
// If auto-rebuy is enabled, then force client to rebuy weapons.
if (g_bZMarketAutoRebuy[client])
{
ZMarketRebuy(client);
ZMarketRebuy(client, true);
}
}
@ -520,7 +511,7 @@ stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false)
}
new bool:zmarketbuyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
if (zmarketbuyzone && !ZMarketIsClientInBuyZone(client))
if (!rebuy && zmarketbuyzone && !ZMarketIsClientInBuyZone(client))
{
TranslationPrintToChat(client, "Weapons zmarket buyzone");
return false;
@ -620,8 +611,11 @@ stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false)
// Add 1 to the client's purchase count.
ZMarketSetPurchaseCount(client, weapon, 1, true);
// Tell client they bought a weapon.
TranslationPrintToChat(client, "Weapons zmarket purchase", weapon);
if (slot != Slot_Invalid && slot != Slot_Projectile)
{
// Tell client they bought a weapon.
TranslationPrintToChat(client, "Weapons zmarket purchase", weapon);
}
}
else if (!rebuy)
{
@ -647,7 +641,7 @@ stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false)
*
* @param client The client index.
*/
ZMarketRebuy(client)
ZMarketRebuy(client, bool:rebuy = false)
{
// If client is a zombie, then stop.
if (InfectIsClientInfected(client))
@ -657,7 +651,7 @@ ZMarketRebuy(client)
}
new bool:zmarketbuyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
if (zmarketbuyzone && !ZMarketIsClientInBuyZone(client))
if (!rebuy && zmarketbuyzone && !ZMarketIsClientInBuyZone(client))
{
TranslationPrintToChat(client, "Weapons zmarket buyzone");
return;
@ -676,6 +670,29 @@ ZMarketRebuy(client)
}
}
/**
* Command callback (zmarket)
* Opens custom buymenu.
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:ZMarketCommand(client, argc)
{
// If client is console, then stop and tell them this feature is for players only.
if (ZRIsConsole(client))
{
TranslationPrintToServer("Must be player");
return Plugin_Handled;
}
// Send ZMarket menu.
ZMarketMenuTypes(client);
// This stops the "Unknown command" message in client's console.
return Plugin_Handled;
}
/**
* Checks if a client is in a buyzone.
*