Is there a way to make the
monster_snark ignore its owner?
what i try (2ways):
Код:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
new const m_hEnemy = 244 //EHANDLE // the entity that the monster is fighting.
public plugin_init() {
RegisterHam ( Ham_Think, "monster_snark", "fw_ThinkSnark" )
//register_forward(FM_Think,"think_Snark")
}
public fw_ThinkSnark ( Snark )
{
if ( !pev_valid ( Snark ) )
return HAM_IGNORED
new Owner = pev(Snark, pev_owner);
set_pev(Snark, pev_owner, iOwner);
new name[33]
get_user_name(Owner, name, charsmax(name))
client_print(0, print_chat, "** Owner Name is : %s", name)
/*set_pev( Entity, pev_vuser1 , 0 );//pev_EnemyTarget
set_pdata_int(iOwner, m_hEnemy, 0, 5)
/set_pev(iOwner, pev_enemy, 0);*/
if(pev(Owner, pev_enemy))
{
client_print(0, print_chat, "******************")
return HAM_IGNORED
}
//set_pev( Entity, pev_nextthink, get_gametime() + 0.01 );
return HAM_IGNORED
}
public think_Snark( Snark )
{
static Classname[33]
pev(Snark,pev_classname,Classname,32)
if(!equal(Classname, "monster_snark"))
return FMRES_IGNORED
new Owner = pev(Snark, pev_owner);
set_pev(Snark, pev_owner, Owner);
new name[33]
get_user_name(Owner, name, charsmax(name))
client_print(0, print_chat, "** Owner Name is : %s", name)
set_pev(Snark,pev_nextthink, get_gametime( ) + 1.0 )
return FMRES_IGNORED
}
Strangely, the owner changes to the server!
I tried to reset the owner back in the code but it did not work?
Цитата:
** Owner Name is : Abdo
** Owner Name is : Abdo
** Owner Name is : Abdo
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
** Owner Name is : Half-Life Server
I'm not sure this problem is or not but what I'm trying to reach is to make the monster_snark not target its owner.