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 */
|
/* BOOLS */
|
||||||
bool g_bLate;
|
bool g_bLate;
|
||||||
|
bool g_bIntermission;
|
||||||
|
|
||||||
/* ARRAYS */
|
/* ARRAYS */
|
||||||
ArrayList g_hArray_Items;
|
ArrayList g_hArray_Items;
|
||||||
@ -77,6 +78,7 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
HookEvent("player_death", OnClientDeath);
|
HookEvent("player_death", OnClientDeath);
|
||||||
HookEvent("round_start", OnRoundStart);
|
HookEvent("round_start", OnRoundStart);
|
||||||
|
HookEvent("round_end", OnRoundEnd);
|
||||||
|
|
||||||
if (g_bLate)
|
if (g_bLate)
|
||||||
{
|
{
|
||||||
@ -167,17 +169,18 @@ public void OnMapStart()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
if (g_hArray_Items.Length)
|
g_bIntermission = false;
|
||||||
{
|
}
|
||||||
for (int index; index < g_hArray_Items.Length; index++)
|
|
||||||
{
|
|
||||||
any itemArray[items];
|
|
||||||
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
|
|
||||||
|
|
||||||
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,75 +456,76 @@ public Action OnButtonPress(int button, int client)
|
|||||||
any itemArray[items];
|
any itemArray[items];
|
||||||
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
|
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
|
||||||
|
|
||||||
if (itemArray[item_button] && itemArray[item_button] == button)
|
if (itemArray[item_button] && itemArray[item_button] == button &&
|
||||||
|
itemArray[item_owned] && itemArray[item_owner] == client)
|
||||||
{
|
{
|
||||||
if (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));
|
||||||
|
Call_PushCell(client);
|
||||||
|
Call_PushCell(index);
|
||||||
|
Call_Finish(aResult);
|
||||||
|
|
||||||
|
if ((aResult == Plugin_Continue) || (aResult == Plugin_Changed))
|
||||||
{
|
{
|
||||||
Action aResult;
|
switch(itemArray[item_mode])
|
||||||
Call_StartForward(g_hFwd_OnClientItemCanActivate);
|
{
|
||||||
|
case(1):
|
||||||
|
{
|
||||||
|
if (itemArray[item_nextuse] < RoundToCeil(GetEngineTime()))
|
||||||
|
{
|
||||||
|
itemArray[item_nextuse] = RoundToCeil(GetEngineTime()) + itemArray[item_cooldown];
|
||||||
|
}
|
||||||
|
else return Plugin_Handled;
|
||||||
|
}
|
||||||
|
case(2):
|
||||||
|
{
|
||||||
|
if (itemArray[item_uses] < itemArray[item_maxuses])
|
||||||
|
{
|
||||||
|
itemArray[item_uses]++;
|
||||||
|
}
|
||||||
|
else return Plugin_Handled;
|
||||||
|
}
|
||||||
|
case(3):
|
||||||
|
{
|
||||||
|
if (itemArray[item_nextuse] < RoundToCeil(GetEngineTime()) && itemArray[item_uses] < itemArray[item_maxuses])
|
||||||
|
{
|
||||||
|
itemArray[item_nextuse] = RoundToCeil(GetEngineTime()) + itemArray[item_cooldown];
|
||||||
|
itemArray[item_uses]++;
|
||||||
|
}
|
||||||
|
else return Plugin_Handled;
|
||||||
|
}
|
||||||
|
case(4):
|
||||||
|
{
|
||||||
|
if (itemArray[item_nextuse] < RoundToCeil(GetEngineTime()))
|
||||||
|
{
|
||||||
|
itemArray[item_uses]++;
|
||||||
|
|
||||||
|
if (itemArray[item_uses] >= itemArray[item_maxuses])
|
||||||
|
{
|
||||||
|
itemArray[item_nextuse] = RoundToCeil(GetEngineTime()) + itemArray[item_cooldown];
|
||||||
|
itemArray[item_uses] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else return Plugin_Handled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemArray[item_filter][0])
|
||||||
|
Entity_SetName(client, itemArray[item_filter]);
|
||||||
|
|
||||||
|
Call_StartForward(g_hFwd_OnClientItemActivate);
|
||||||
Call_PushArray(itemArray, sizeof(itemArray));
|
Call_PushArray(itemArray, sizeof(itemArray));
|
||||||
Call_PushCell(client);
|
Call_PushCell(client);
|
||||||
Call_PushCell(index);
|
Call_PushCell(index);
|
||||||
Call_Finish(aResult);
|
Call_Finish();
|
||||||
|
|
||||||
if ((aResult == Plugin_Continue) || (aResult == Plugin_Changed))
|
|
||||||
{
|
|
||||||
switch(itemArray[item_mode])
|
|
||||||
{
|
|
||||||
case(1):
|
|
||||||
{
|
|
||||||
if (itemArray[item_nextuse] < RoundToCeil(GetEngineTime()))
|
|
||||||
{
|
|
||||||
itemArray[item_nextuse] = RoundToCeil(GetEngineTime()) + itemArray[item_cooldown];
|
|
||||||
}
|
|
||||||
else return Plugin_Handled;
|
|
||||||
}
|
|
||||||
case(2):
|
|
||||||
{
|
|
||||||
if (itemArray[item_uses] < itemArray[item_maxuses])
|
|
||||||
{
|
|
||||||
itemArray[item_uses]++;
|
|
||||||
}
|
|
||||||
else return Plugin_Handled;
|
|
||||||
}
|
|
||||||
case(3):
|
|
||||||
{
|
|
||||||
if (itemArray[item_nextuse] < RoundToCeil(GetEngineTime()) && itemArray[item_uses] < itemArray[item_maxuses])
|
|
||||||
{
|
|
||||||
itemArray[item_nextuse] = RoundToCeil(GetEngineTime()) + itemArray[item_cooldown];
|
|
||||||
itemArray[item_uses]++;
|
|
||||||
}
|
|
||||||
else return Plugin_Handled;
|
|
||||||
}
|
|
||||||
case(4):
|
|
||||||
{
|
|
||||||
if (itemArray[item_nextuse] < RoundToCeil(GetEngineTime()))
|
|
||||||
{
|
|
||||||
itemArray[item_uses]++;
|
|
||||||
|
|
||||||
if (itemArray[item_uses] >= itemArray[item_maxuses])
|
|
||||||
{
|
|
||||||
itemArray[item_nextuse] = RoundToCeil(GetEngineTime()) + itemArray[item_cooldown];
|
|
||||||
itemArray[item_uses] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else return Plugin_Handled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemArray[item_filter][0])
|
|
||||||
Entity_SetName(client, itemArray[item_filter]);
|
|
||||||
|
|
||||||
Call_StartForward(g_hFwd_OnClientItemActivate);
|
|
||||||
Call_PushArray(itemArray, sizeof(itemArray));
|
|
||||||
Call_PushCell(client);
|
|
||||||
Call_PushCell(index);
|
|
||||||
Call_Finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
|
|
||||||
return aResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
|
||||||
|
return aResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,6 +546,9 @@ public Action OnTriggerTouch(int trigger, int client)
|
|||||||
|
|
||||||
if (itemArray[item_trigger] && itemArray[item_trigger] == trigger)
|
if (itemArray[item_trigger] && itemArray[item_trigger] == trigger)
|
||||||
{
|
{
|
||||||
|
if (g_bIntermission)
|
||||||
|
return Plugin_Handled;
|
||||||
|
|
||||||
Action aResult;
|
Action aResult;
|
||||||
Call_StartForward(g_hFwd_OnClientItemCanPickup);
|
Call_StartForward(g_hFwd_OnClientItemCanPickup);
|
||||||
Call_PushArray(itemArray, sizeof(itemArray));
|
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 (itemArray[item_weapon] && itemArray[item_weapon] == weapon)
|
||||||
{
|
{
|
||||||
|
if (g_bIntermission)
|
||||||
|
return Plugin_Handled;
|
||||||
|
|
||||||
Action aResult;
|
Action aResult;
|
||||||
Call_StartForward(g_hFwd_OnClientItemCanPickup);
|
Call_StartForward(g_hFwd_OnClientItemCanPickup);
|
||||||
Call_PushArray(itemArray, sizeof(itemArray));
|
Call_PushArray(itemArray, sizeof(itemArray));
|
||||||
|
Loading…
Reference in New Issue
Block a user