you need a 2 or 3 seconds delay for HLTV event since dead players won't be respawned yet.
so it should be like this.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#define VERSION "0.0.1"
#define PLUGIN ""
#define TASK_PLAYERS_SPAWNED 500
public plugin_init()
{
register_plugin(PLUGIN, VERSION, "iceeedR")
register_event("HLTV","event_hltv", "a", "1=0", "2=0")
}
public event_hltv()
{
remove_task(TASK_PLAYERS_SPAWNED);
set_task(3.0, "Players_Spawned", TASK_PLAYERS_SPAWNED)
}
public Players_Spawned(taskid)
{
new GotTheBomb = 0;
new iPlayers[MAX_PLAYERS],iNum, id
get_players(iPlayers, iNum, "ah", "TERRORIST")
for(new i; i < iNum;i++)
{
id = iPlayers[i]
if (!(user_has_weapon(id, CSW_C4)))
continue
GotTheBomb ++
if(GotTheBomb && GotTheBomb != 1)
{
ham_strip_user_weapon(id, CSW_C4)
GotTheBomb --;
}
}
}
// stock made by drekes (removed from stripweapons.inc)
stock ham_strip_user_weapon(id, iCswId, iSlot = 0, bool:bSwitchIfActive = true)
{
new iWeapon
if( !iSlot )
{
static const iWeaponsSlots[] = {
-1,
2, //CSW_P228
-1,
1, //CSW_SCOUT
4, //CSW_HEGRENADE
1, //CSW_XM1014
5, //CSW_C4
1, //CSW_MAC10
1, //CSW_AUG
4, //CSW_SMOKEGRENADE
2, //CSW_ELITE
2, //CSW_FIVESEVEN
1, //CSW_UMP45
1, //CSW_SG550
1, //CSW_GALIL
1, //CSW_FAMAS
2, //CSW_USP
2, //CSW_GLOCK18
1, //CSW_AWP
1, //CSW_MP5NAVY
1, //CSW_M249
1, //CSW_M3
1, //CSW_M4A1
1, //CSW_TMP
1, //CSW_G3SG1
4, //CSW_FLASHBANG
2, //CSW_DEAGLE
1, //CSW_SG552
1, //CSW_AK47
3, //CSW_KNIFE
1 //CSW_P90
}
iSlot = iWeaponsSlots[iCswId]
}
const XTRA_OFS_PLAYER = 5
const m_rgpPlayerItems_Slot0 = 367
iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_Slot0 + iSlot, XTRA_OFS_PLAYER)
const XTRA_OFS_WEAPON = 4
const m_pNext = 42
const m_iId = 43
while( iWeapon > 0 )
{
if( get_pdata_int(iWeapon, m_iId, XTRA_OFS_WEAPON) == iCswId )
{
break
}
iWeapon = get_pdata_cbase(iWeapon, m_pNext, XTRA_OFS_WEAPON)
}
if( iWeapon > 0 )
{
const m_pActiveItem = 373
if( bSwitchIfActive && get_pdata_cbase(id, m_pActiveItem, XTRA_OFS_PLAYER) == iWeapon )
{
ExecuteHamB(Ham_Weapon_RetireWeapon, iWeapon)
}
if( ExecuteHamB(Ham_RemovePlayerItem, id, iWeapon) )
{
user_has_weapon(id, iCswId, 0)
ExecuteHamB(Ham_Item_Kill, iWeapon)
return 1
}
}
return 0
}