| Randomize |
08-12-2013 03:47 |
Bug with my plugin
I have created bomb with entity to be thrown and explode when I dectonate it such as satchel charge. It works fine if I'm alone, but If there's a player who uses that item too the bug happens. I throw my bomb and he throw his bomb, when I dectonate mine it don't want to explode. But when he dectonate his, his bomb explodes.
Here is part of my code:
PHP Code:
public explode_bomb(id) { if(!is_valid_ent(id) || !is_valid_ent(c5_entity)) return PLUGIN_CONTINUE if(!is_user_connected(id) || !is_user_alive(id)) return PLUGIN_CONTINUE
new Float:fOrigin[3] new iOrigin[3] entity_get_vector(c5_entity, EV_VEC_origin, fOrigin) new g_owner = entity_get_edict(c5_entity, EV_ENT_owner) client_print( id, print_chat, "%i %s", g_owner, g_owner) new g_players[32], g_playersnum, x get_players(g_players, g_playersnum, "a") FVecIVec(fOrigin, iOrigin) if (g_has_planted[id]) { if (g_owner == id) { for(x = 0; x <= g_playersnum; x++) { new i = g_players[x] if(!is_user_connected(i)) continue new g_distance = floatround(entity_range(c5_entity, i)) if (g_distance <= get_pcvar_num(g_radius)) //c5 distance between player less equal with c5 radius { if(get_user_team(id) != get_user_team(i)) { if((get_user_health(i) - get_pcvar_num(g_damage)) <= 0) { user_silentkill(i) emit_sound(id, CHAN_AUTO, g_c5_kill, 1.0, ATTN_NORM, 0, PITCH_NORM) make_deathmsg(id, i, 0, "c5") cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(g_reward)) set_user_frags(id, get_user_frags(id) + 1) } else { set_user_health(i, get_user_health(i) - get_pcvar_num(g_damage)) emit_sound(id, CHAN_AUTO, g_c5_kill, 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() cs_set_user_bpammo(id, CSW_HEGRENADE, 0) emit_sound(id, CHAN_AUTO, g_c5_sound[4], 1.0, ATTN_NORM, 0, PITCH_NORM) remove_entity(c5_entity) g_has_planted[id] = false g_has_dectonator[id] = false g_bought[id] = false return PLUGIN_HANDLED } return PLUGIN_HANDLED } return PLUGIN_HANDLED }
|