sorry but it didn't work, it still only counts as kill, and doesn't add frag to which the entity was created
this is all important of the code
PHP Code:
public plugin_init()
{
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
register_event("ResetHUD", "newRound","b")
register_event("DeathMsg","deathevent","a")
}
//----------------------------------------------------------------------------------------------
public newRound()
{
new coronavirus = find_ent_by_class(-1, "coronavirus")
while(coronavirus) {
remove_entity(coronavirus)
coronavirus = find_ent_by_class(coronavirus, "coronavirus")
}
}
//----------------------------------------------------------------------------------------------
public deathevent
{
new killer = read_data(1)
new victim = read_data(2)
if ( victim == killer ) return
if ( is_user_alive(killer ) && gHasCoronaPower[killer ] ) {
createcoronavirus(victim)
new aimvec[3]
get_user_origin(victim, aimvec)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(23)
write_coord(aimvec[0])
write_coord(aimvec[1])
write_coord(aimvec[2])
write_short(Smoke)
write_byte(001)
write_byte(65)
write_byte(200)
message_end()
aimvec[2] -= 100
set_user_origin(victim, aimvec)
}
}
//----------------------------------------------------------------------------------------------
public createcoronavirus(victim)
{
new Float:vAim[3], Float:vOrigin[3]
entity_get_vector(victim, EV_VEC_origin, vOrigin)
VelocityByAim(victim, random_num(2, 4), vAim)
vOrigin[0] += vAim[0]
vOrigin[1] += vAim[1]
vOrigin[2] += 30.0
new coronavirus = create_entity("info_target")
entity_set_string(coronavirus, EV_SZ_classname, "coronavirus")
entity_set_model(coronavirus, "models/shmod/coronavirus.mdl")
entity_set_size(coronavirus, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5})
entity_set_int(coronavirus, EV_INT_solid, 2)
entity_set_int(coronavirus, EV_INT_movetype, 6)
entity_set_vector(coronavirus, EV_VEC_origin, vOrigin)
}
//----------------------------------------------------------------------------------------------
public pfn_touch(ptr, ptd)
{
if(!is_valid_ent(ptd) || !is_valid_ent(ptr))
return PLUGIN_CONTINUE
if(!is_user_connected(ptd) || !is_user_alive(ptd))
return PLUGIN_CONTINUE
new classname[32]
entity_get_string(ptr, EV_SZ_classname, classname, 31)
if(equal(classname, "coronavirus")) {
static pUserMsgDeathMSG = 0; if(!pUserMsgDeathMSG) pUserMsgDeathMSG = get_user_msgid("DeathMsg");
// This is to make the one who touches the entity die
set_user_health(ptd, -1)
static iOwner;
iOwner = entity_get_edict(ptr, EV_ENT_owner);
if(is_user_connected(iOwner)) {
set_user_frags(iOwner, get_user_frags(iOwner) + 1);
message_begin(MSG_ALL, pUserMsgDeathMSG, _, 0);
write_byte(iOwner);
write_byte(ptd);
write_byte(0);
write_string("coronavirus");
message_end();
}
remove_entity(ptr);
}
return PLUGIN_CONTINUE
}