ItemSpawn: Add a filter for items onto balrog.
This commit is contained in:
parent
507ef3b0a8
commit
129d0ec2b7
@ -2,6 +2,7 @@
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <sdkhooks>
|
||||
#include <zombiereloaded>
|
||||
#include <cstrike>
|
||||
|
||||
@ -9,6 +10,8 @@
|
||||
|
||||
int g_iCounter = 0;
|
||||
|
||||
bool g_bClientHasItem[MAXPLAYERS+1] = false;
|
||||
|
||||
Handle g_hGetSlot;
|
||||
Handle g_hBumpWeapon;
|
||||
Handle g_hOnPickedUp;
|
||||
@ -287,6 +290,24 @@ stock void SetEntityProps(int entity)
|
||||
SetEntProp(entity, Prop_Send, "m_fEffects", 32);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
stock void AddItemFilter(int entity)
|
||||
{
|
||||
SDKHook(entity, SDKHook_StartTouch, OnTriggerTouch);
|
||||
SDKHook(entity, SDKHook_EndTouch, OnTriggerTouch);
|
||||
SDKHook(entity, SDKHook_Touch, OnTriggerTouch);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action OnTriggerTouch(int trigger, int client)
|
||||
{
|
||||
return (IsValidClient(client) && g_bClientHasItem[client]) ? Plugin_Handled : Plugin_Continue;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -323,11 +344,24 @@ public bool IsValidClient(int client)
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
g_bClientHasItem[client] = false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
g_bClientHasItem[client] = false;
|
||||
}
|
||||
|
||||
g_iCounter = 0;
|
||||
|
||||
// player_weaponstrip.
|
||||
|
@ -140,6 +140,7 @@ public void SpawnBalrog(float fOrigin[3])
|
||||
DispatchKeyFormat(iTriggerRoar, "OnStartTouch", "item_spawn_speedmod,ModifySpeed,1.0,10,-1");
|
||||
SpawnAndActivate(iTriggerRoar);
|
||||
ParentToEntity(iTriggerRoar, iKnife);
|
||||
AddItemFilter(iTriggerRoar);
|
||||
|
||||
// make the trigger work.
|
||||
SetEntityBBox(iTriggerRoar, view_as<float>({-736.0, -736.0, -560.0}), view_as<float>({736.0, 736.0, 560.0}));
|
||||
@ -356,9 +357,13 @@ public void SpawnBalrog(float fOrigin[3])
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void BalrogPickup(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
ServerCommand("say ** %N has picked up Balrog **", activator);
|
||||
if (IsValidClient(activator))
|
||||
{
|
||||
ServerCommand("say ** %N has picked up Balrog **", activator);
|
||||
|
||||
PrintToChat(activator, "RIGHT CLICK = MOTIVATE ZOMBIES and LEFT CLICK = ATTACK.");
|
||||
PrintToChat(activator, "RIGHT CLICK = MOTIVATE ZOMBIES and LEFT CLICK = ATTACK.");
|
||||
g_bClientHasItem[activator] = true;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user