diff --git a/_entWatch4/scripting/entWatch-core.sp b/_entWatch4/scripting/entWatch-core.sp index 2e3e8ab3..8b80d439 100644 --- a/_entWatch4/scripting/entWatch-core.sp +++ b/_entWatch4/scripting/entWatch-core.sp @@ -221,50 +221,35 @@ public void OnEntitySpawned(int entity) if (config.iWeaponID && config.iWeaponID == Entity_GetHammerId(entity)) { - bool bExisting; - if ((bExisting = RegisterExistingItem(entity, REGISTERTYPE_WEAPON))) + bool bExisting = RegisterExistingItem(entity, REGISTERTYPE_WEAPON); + if (!bExisting) { - if (!bExisting) - { - CItem item = new CItem(config); + CItem item = new CItem(config); - if (RegisterItemEntity(item, entity, REGISTERTYPE_WEAPON)) - g_hArray_Items.Push(item); - } - - return; + if (RegisterItemEntity(item, entity, REGISTERTYPE_WEAPON)) + g_hArray_Items.Push(item); } } else if (config.iButtonID && config.iButtonID == Entity_GetHammerId(entity)) { - bool bExisting; - if ((bExisting = RegisterExistingItem(entity, REGISTERTYPE_BUTTON))) + bool bExisting = RegisterExistingItem(entity, REGISTERTYPE_BUTTON); + if (!bExisting) { - if (!bExisting) - { - CItem item = new CItem(config); + CItem item = new CItem(config); - if (RegisterItemEntity(item, entity, REGISTERTYPE_BUTTON)) - g_hArray_Items.Push(item); - } - - return; + if (RegisterItemEntity(item, entity, REGISTERTYPE_BUTTON)) + g_hArray_Items.Push(item); } } else if (config.iTriggerID && config.iTriggerID == Entity_GetHammerId(entity)) { - bool bExisting; - if ((bExisting = RegisterExistingItem(entity, REGISTERTYPE_TRIGGER))) + bool bExisting = RegisterExistingItem(entity, REGISTERTYPE_TRIGGER); + if (!bExisting) { - if (!bExisting) - { - CItem item = new CItem(config); + CItem item = new CItem(config); - if (RegisterItemEntity(item, entity, REGISTERTYPE_TRIGGER)) - g_hArray_Items.Push(item); - } - - return; + if (RegisterItemEntity(item, entity, REGISTERTYPE_TRIGGER)) + g_hArray_Items.Push(item); } } } @@ -299,7 +284,7 @@ stock bool RegisterItemEntity(CItem item, int entity, int type) { switch(type) { - case(1): + case REGISTERTYPE_WEAPON: { if (!item.bWeapon && (Entity_GetOwner(entity) == INVALID_ENT_REFERENCE)) { @@ -308,7 +293,7 @@ stock bool RegisterItemEntity(CItem item, int entity, int type) return true; } } - case(2): + case REGISTERTYPE_BUTTON: { if (!item.bButton && (Entity_GetParent(entity) == INVALID_ENT_REFERENCE || (item.bWeapon && Entity_GetParent(entity) == item.iWeapon))) { @@ -319,7 +304,7 @@ stock bool RegisterItemEntity(CItem item, int entity, int type) return true; } } - case(3): + case REGISTERTYPE_TRIGGER: { if (!item.bTrigger && (Entity_GetParent(entity) == INVALID_ENT_REFERENCE || (item.bWeapon && Entity_GetParent(entity) == item.iWeapon))) { @@ -519,11 +504,11 @@ public Action OnButtonPress(int button, int client) switch(aResult) { - case(Plugin_Continue, Plugin_Changed): + case Plugin_Continue, Plugin_Changed: { switch(item.dConfig.iMode) { - case(1): + case 1: { if (item.iTimeReady < RoundToCeil(GetEngineTime())) { @@ -531,7 +516,7 @@ public Action OnButtonPress(int button, int client) } else return Plugin_Handled; } - case(2): + case 2: { if (item.iTimesUsed < item.dConfig.iMaxUses) { @@ -539,7 +524,7 @@ public Action OnButtonPress(int button, int client) } else return Plugin_Handled; } - case(3): + case 3: { if (item.iTimeReady < RoundToCeil(GetEngineTime()) && item.iTimesUsed < item.dConfig.iMaxUses) { @@ -548,7 +533,7 @@ public Action OnButtonPress(int button, int client) } else return Plugin_Handled; } - case(4): + case 4: { if (item.iTimeReady < RoundToCeil(GetEngineTime())) { diff --git a/_entWatch4/scripting/temp/entWatch-interface.sp b/_entWatch4/scripting/temp/entWatch-interface.sp index c532a049..453c6553 100644 --- a/_entWatch4/scripting/temp/entWatch-interface.sp +++ b/_entWatch4/scripting/temp/entWatch-interface.sp @@ -44,7 +44,7 @@ public void OnGameFrame() { switch(itemArray[item_mode]) { - case(1): + case 1: { if (itemArray[item_nextuse] > RoundToCeil(GetEngineTime())) { @@ -55,7 +55,7 @@ public void OnGameFrame() Format(sHUDBuffer, sizeof(sHUDBuffer), "%s [%s]: %N", itemArray[item_short], "R", itemArray[item_owner]); } } - case(2): + case 2: { if (itemArray[item_uses] < itemArray[item_maxuses]) { @@ -66,7 +66,7 @@ public void OnGameFrame() Format(sHUDBuffer, sizeof(sHUDBuffer), "%s [%s]: %N", itemArray[item_short], "D", itemArray[item_owner]); } } - case(3): + case 3: { if (itemArray[item_uses] < itemArray[item_maxuses]) { @@ -84,7 +84,7 @@ public void OnGameFrame() Format(sHUDBuffer, sizeof(sHUDBuffer), "%s [%s]: %N", itemArray[item_short], "D", itemArray[item_owner]); } } - case(4): + case 4: { if (itemArray[item_nextuse] > RoundToCeil(GetEngineTime())) {