| Randomize |
08-08-2013 11:15 |
Re: Explode an entity
Yes I want to slap/kill them. What I've done is like this:
PHP Code:
public explode_bomb(id) { if(!is_valid_ent(c5_entity)) { client_print(0 , print_chat , "* Invalid ENTITY: %i" , c5_entity); } new ent_c5 = entity_get_int(c5_entity, EV_ENT_owner) new Float:fOrigin[3] new iOrigin[3] new g_players[32], g_playersnum, x get_players(g_players, g_playersnum, "a") entity_get_vector(c5_entity, EV_VEC_origin, fOrigin) FVecIVec(fOrigin, iOrigin) for(x = 0; x <= g_playersnum; x++) { new i = g_players[x]
new g_distance = floatround(entity_range(c5_entity, i))
if (g_distance <= 300) { if(get_user_team(id) != get_user_team(i)) { user_silentkill(i) make_deathmsg(id, i, 0, "grenade") set_user_frags(id, get_user_frags(id) + 1) emit_sound(id, CHAN_AUTO, g_c5_hit[random_num(0, 2)], 1.0, ATTN_NORM, 0, PITCH_NORM) cs_set_user_money(id, cs_get_user_money(id) + 300) } else { if(get_user_team(id) != get_user_team(i)) { set_user_health(i, get_user_health(i) - 100) emit_sound(id, CHAN_AUTO, g_c5_hit[random_num(0, 2)], 1.0, ATTN_NORM, 0, PITCH_NORM) } } } } message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iOrigin) write_byte (TE_EXPLOSION) write_coord(iOrigin[0]) write_coord(iOrigin[1]) write_coord(iOrigin[2]) write_short(explode) write_byte (30) write_byte (15) write_byte (0) message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iOrigin) write_byte (TE_SMOKE) write_coord(iOrigin[0]) write_coord(iOrigin[1]) write_coord(iOrigin[2]) write_short(smoke) write_byte (100) write_byte (15) message_end() engclient_cmd(id, "lastinv") cs_set_user_bpammo(id, CSW_HEGRENADE, 0) remove_entity(c5_entity) g_has_dectonator[id] = false g_has_planted[id] = false g_bought[id] = false }
|