entWatch4: Drop based on configured slot.
Dont drop if not configured, or knife.
This commit is contained in:
parent
d4402823c8
commit
b5c1b36d25
@ -17,6 +17,12 @@
|
||||
// 5 = CHAT & HUD.
|
||||
// 6 = USE & HUD.
|
||||
// 7 = ALL.
|
||||
"slot" "0" // The weapon slot.
|
||||
// 0 = None
|
||||
// 1 = Primary
|
||||
// 2 = Secondary
|
||||
// 3 = Knife
|
||||
// 4 = Grenade
|
||||
"mode" "0" // The mode of the item.
|
||||
// 1 = Cooldown.
|
||||
// 2 = Limited uses.
|
||||
|
@ -21,6 +21,7 @@ methodmap CConfig < Basic
|
||||
myclass.SetInt("iTriggerID", 0);
|
||||
|
||||
myclass.SetInt("iDisplay", 0);
|
||||
myclass.SetInt("iSlot", 0);
|
||||
myclass.SetInt("iMode", 0);
|
||||
|
||||
myclass.SetInt("iMaxUses", 0);
|
||||
@ -132,6 +133,18 @@ methodmap CConfig < Basic
|
||||
}
|
||||
}
|
||||
|
||||
property int iSlot
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iSlot");
|
||||
}
|
||||
public set(int value)
|
||||
{
|
||||
this.SetInt("iSlot", value);
|
||||
}
|
||||
}
|
||||
|
||||
property int iMode
|
||||
{
|
||||
public get()
|
||||
|
@ -159,6 +159,7 @@ public void OnMapStart()
|
||||
config.iButtonID = hConfig.GetNum("buttonid");
|
||||
config.iTriggerID = hConfig.GetNum("triggerid");
|
||||
config.iDisplay = hConfig.GetNum("display");
|
||||
config.iSlot = hConfig.GetNum("slot");
|
||||
config.iMode = hConfig.GetNum("mode");
|
||||
config.iMaxUses = hConfig.GetNum("maxuses");
|
||||
config.iCooldown = hConfig.GetNum("cooldown");
|
||||
@ -417,6 +418,11 @@ public void OnClientDisconnect(int client)
|
||||
|
||||
if (item.bClient && item.iClient == client)
|
||||
{
|
||||
if (item.bWeapon && !(item.dConfig.iSlot == SLOT_NONE || item.dConfig.iSlot == SLOT_KNIFE))
|
||||
{
|
||||
SDKHooks_DropWeapon(item.iClient, item.iWeapon, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
item.iClient = INVALID_ENT_REFERENCE;
|
||||
|
||||
Call_StartForward(g_hFwd_OnClientItemDisconnect);
|
||||
@ -443,6 +449,11 @@ public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast
|
||||
|
||||
if (item.bClient && item.iClient == client)
|
||||
{
|
||||
if (item.bWeapon && !(item.dConfig.iSlot == SLOT_NONE || item.dConfig.iSlot == SLOT_KNIFE))
|
||||
{
|
||||
SDKHooks_DropWeapon(item.iClient, item.iWeapon, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
item.iClient = INVALID_ENT_REFERENCE;
|
||||
|
||||
Call_StartForward(g_hFwd_OnClientItemDeath);
|
||||
|
@ -9,6 +9,13 @@
|
||||
#define REGISTER_BUTTON 2
|
||||
#define REGISTER_TRIGGER 3
|
||||
|
||||
/* SLOTS */
|
||||
#define SLOT_NONE 0
|
||||
#define SLOT_PRIMARY 1
|
||||
#define SLOT_SECONDARY 2
|
||||
#define SLOT_KNIFE 3
|
||||
#define SLOT_GRENADES 4
|
||||
|
||||
/* MODES */
|
||||
#define MODE_COOLDOWN 1
|
||||
#define MODE_MAXUSES 2
|
||||
|
Loading…
Reference in New Issue
Block a user