Problem is that you are trying to find a planted bomb when bomber is planting, so you won't ever be able to find one as you come at the begining of the process.
Better to include <csx> and to use forward "bomb_planted"
Usage :
PHP Code:
public bomb_planted( planter )
{
// search for planted c4 here
}
PHP Code:
new pname[32]
get_user_name(id,pname,32)
This is not correct, you can fill the name string array untill 31, better to use charsmax(pname) instead of 31, and more generally, so when you change an array size you don't have to edit more lines.
->
PHP Code:
new pname[32]
get_user_name(id, pname, charsmax(pname))
Also, your bomb detection is not efficient enough considering some plugins may change the c4 model, better to check m_bIsC4 pdata for this :
PHP Code:
#include < amxmodx >
#include < engine >
#include < fakemeta >
#include < csx >
const m_bIsC4 = 385;
public bomb_planted( planter )
{
new c4 = find_planted_c4();
if( c4 )
{
}
}
find_planted_c4(iSearchAfter = -1)
{
new grenade = iSearchAfter;
while( (grenade = find_ent_by_class(grenade, "grenade")) )
{
if( get_pdata_bool(grenade, m_bIsC4) )
{
return grenade;
}
}
return 0;
}
Note : get_pdata_bool native has been added in amxx1.8.3, you can find it here (not official yet) :
http://www.amxmodx.org/snapshots.php
If you want to stick with amxx 1.8.2 for now, you can find get_pdata_bool stock here :
http://forums.alliedmods.net/showpos...01#post1712101
I'm not sure, but for some reason csx module could send bomb_planted forward before the bomb is completely planted, so if the code doesn't work, use a delayed 0.1s task from bomb_planted in order to be able to retrieve correctly c4 index.
__________________