entWatch4: Update, Delete and Yeah

This commit is contained in:
zaCade
2019-03-28 15:34:18 +01:00
parent 6ddff93394
commit c0c6dd3179
11 changed files with 34 additions and 297 deletions
+14 -23
View File
@@ -12,16 +12,7 @@
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <basic>
/* CLASSES */
#include "CConfig.inc"
#include "CItem.inc"
/* REGISTERTYPES */
#define REGISTERTYPE_WEAPON 1
#define REGISTERTYPE_BUTTON 2
#define REGISTERTYPE_TRIGGER 3
#include <entWatch_core>
/* BOOLS */
bool g_bLate;
@@ -221,31 +212,31 @@ public void OnEntitySpawned(int entity)
if (config.iWeaponID && config.iWeaponID == Entity_GetHammerId(entity))
{
if (!RegisterExistingItem(entity, REGISTERTYPE_WEAPON))
if (!RegisterExistingItem(entity, REGISTER_WEAPON))
{
CItem item = new CItem(config);
if (RegisterItemEntity(item, entity, REGISTERTYPE_WEAPON))
if (RegisterItemEntity(item, entity, REGISTER_WEAPON))
g_hArray_Items.Push(item);
}
}
else if (config.iButtonID && config.iButtonID == Entity_GetHammerId(entity))
{
if (!RegisterExistingItem(entity, REGISTERTYPE_BUTTON))
if (!RegisterExistingItem(entity, REGISTER_BUTTON))
{
CItem item = new CItem(config);
if (RegisterItemEntity(item, entity, REGISTERTYPE_BUTTON))
if (RegisterItemEntity(item, entity, REGISTER_BUTTON))
g_hArray_Items.Push(item);
}
}
else if (config.iTriggerID && config.iTriggerID == Entity_GetHammerId(entity))
{
if (!RegisterExistingItem(entity, REGISTERTYPE_TRIGGER))
if (!RegisterExistingItem(entity, REGISTER_TRIGGER))
{
CItem item = new CItem(config);
if (RegisterItemEntity(item, entity, REGISTERTYPE_TRIGGER))
if (RegisterItemEntity(item, entity, REGISTER_TRIGGER))
g_hArray_Items.Push(item);
}
}
@@ -281,7 +272,7 @@ stock bool RegisterItemEntity(CItem item, int entity, int type)
{
switch(type)
{
case REGISTERTYPE_WEAPON:
case REGISTER_WEAPON:
{
if (!item.bWeapon && (Entity_GetOwner(entity) == INVALID_ENT_REFERENCE))
{
@@ -290,7 +281,7 @@ stock bool RegisterItemEntity(CItem item, int entity, int type)
return true;
}
}
case REGISTERTYPE_BUTTON:
case REGISTER_BUTTON:
{
if (!item.bButton && (Entity_GetParent(entity) == INVALID_ENT_REFERENCE || (item.bWeapon && Entity_GetParent(entity) == item.iWeapon)))
{
@@ -301,7 +292,7 @@ stock bool RegisterItemEntity(CItem item, int entity, int type)
return true;
}
}
case REGISTERTYPE_TRIGGER:
case REGISTER_TRIGGER:
{
if (!item.bTrigger && (Entity_GetParent(entity) == INVALID_ENT_REFERENCE || (item.bWeapon && Entity_GetParent(entity) == item.iWeapon)))
{
@@ -499,7 +490,7 @@ public Action OnButtonPress(int button, int client)
{
switch(item.dConfig.iMode)
{
case 1:
case MODE_COOLDOWN:
{
if (item.iTimeReady < RoundToCeil(GetEngineTime()))
{
@@ -507,7 +498,7 @@ public Action OnButtonPress(int button, int client)
}
else return Plugin_Handled;
}
case 2:
case MODE_MAXUSES:
{
if (item.iTimesUsed < item.dConfig.iMaxUses)
{
@@ -515,7 +506,7 @@ public Action OnButtonPress(int button, int client)
}
else return Plugin_Handled;
}
case 3:
case MODE_COOLDOWNMAXUSES:
{
if (item.iTimeReady < RoundToCeil(GetEngineTime()) && item.iTimesUsed < item.dConfig.iMaxUses)
{
@@ -524,7 +515,7 @@ public Action OnButtonPress(int button, int client)
}
else return Plugin_Handled;
}
case 4:
case MODE_COOLDOWNCHARGES:
{
if (item.iTimeReady < RoundToCeil(GetEngineTime()))
{