entWatch4: Streamline code + Intermission change.
Block 'Press', 'Touch' and 'Pickup' during intermission.
This commit is contained in:
parent
d4b9a3887b
commit
b4116d7282
@ -16,6 +16,7 @@
|
||||
|
||||
/* BOOLS */
|
||||
bool g_bLate;
|
||||
bool g_bIntermission;
|
||||
|
||||
/* ARRAYS */
|
||||
ArrayList g_hArray_Items;
|
||||
@ -77,6 +78,7 @@ public void OnPluginStart()
|
||||
|
||||
HookEvent("player_death", OnClientDeath);
|
||||
HookEvent("round_start", OnRoundStart);
|
||||
HookEvent("round_end", OnRoundEnd);
|
||||
|
||||
if (g_bLate)
|
||||
{
|
||||
@ -167,17 +169,18 @@ public void OnMapStart()
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
if (g_hArray_Items.Length)
|
||||
{
|
||||
for (int index; index < g_hArray_Items.Length; index++)
|
||||
{
|
||||
any itemArray[items];
|
||||
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
|
||||
g_bIntermission = false;
|
||||
}
|
||||
|
||||
if (itemArray[item_owned] && itemArray[item_owner] >= 0)
|
||||
g_hArray_Items.Erase(index);
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
g_bIntermission = true;
|
||||
|
||||
if (g_hArray_Items.Length)
|
||||
g_hArray_Items.Clear();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -453,10 +456,12 @@ public Action OnButtonPress(int button, int client)
|
||||
any itemArray[items];
|
||||
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
|
||||
|
||||
if (itemArray[item_button] && itemArray[item_button] == button)
|
||||
{
|
||||
if (itemArray[item_owned] && itemArray[item_owner] == client)
|
||||
if (itemArray[item_button] && itemArray[item_button] == button &&
|
||||
itemArray[item_owned] && itemArray[item_owner] == client)
|
||||
{
|
||||
if (g_bIntermission)
|
||||
return Plugin_Handled;
|
||||
|
||||
Action aResult;
|
||||
Call_StartForward(g_hFwd_OnClientItemCanActivate);
|
||||
Call_PushArray(itemArray, sizeof(itemArray));
|
||||
@ -524,7 +529,6 @@ public Action OnButtonPress(int button, int client)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -542,6 +546,9 @@ public Action OnTriggerTouch(int trigger, int client)
|
||||
|
||||
if (itemArray[item_trigger] && itemArray[item_trigger] == trigger)
|
||||
{
|
||||
if (g_bIntermission)
|
||||
return Plugin_Handled;
|
||||
|
||||
Action aResult;
|
||||
Call_StartForward(g_hFwd_OnClientItemCanPickup);
|
||||
Call_PushArray(itemArray, sizeof(itemArray));
|
||||
@ -571,6 +578,9 @@ public Action OnWeaponTouch(int client, int weapon)
|
||||
|
||||
if (itemArray[item_weapon] && itemArray[item_weapon] == weapon)
|
||||
{
|
||||
if (g_bIntermission)
|
||||
return Plugin_Handled;
|
||||
|
||||
Action aResult;
|
||||
Call_StartForward(g_hFwd_OnClientItemCanPickup);
|
||||
Call_PushArray(itemArray, sizeof(itemArray));
|
||||
|
Loading…
Reference in New Issue
Block a user