Code: Select all
public Entity_Touched(ent, victim){ if (!pev_valid(ent)) return; new classname[32] pev( ent, pev_classname, classname,31) new attacker = pev( ent, pev_owner) new user_team = get_user_team(attacker) if(equal(classname,"RPG")) { new Float:fOrigin[3], iOrigin[3]; pev(ent , pev_origin, fOrigin) iOrigin[0] = floatround(fOrigin[0]) iOrigin[1] = floatround(fOrigin[1]) iOrigin[2] = floatround(fOrigin[2]) message_begin(MSG_BROADCAST,SVC_TEMPENTITY, iOrigin) write_byte(TE_EXPLOSION) engfunc( EngFunc_WriteCoord,fOrigin[0]) engfunc( EngFunc_WriteCoord,fOrigin[1]) engfunc( EngFunc_WriteCoord,fOrigin[2]) write_short(explodespr) write_byte(30) write_byte(15) write_byte(0) message_end() new a, b, Float: origin[3], Float:origin2[3], Float:distance, Float:damage, Float:velocity[3]; pev(ent, pev_origin, origin); while (a++ < g_iMaxPlayers) if (is_user_alive(a)) if (user_team != get_user_team(a)) { pev(a, pev_origin, origin2); distance = get_distance_f(origin, origin2); if (distance < get_pcvar_num(rpg_damage)) { damage = (get_distance_f(origin, origin2) / get_pcvar_float(rpg_damage)) if (damage > 0.0) { if (origin2[2] < origin[2]) origin2[2] = origin[2]; pev(a, pev_velocity, velocity); for (b = 0; b < 3; b++) velocity[b] += (((origin2[b] - origin[b]) * get_pcvar_float(rpg_knockback) / distance + origin[b]) - origin2[b]) * 1.6; set_pev(a, pev_velocity, velocity); ExecuteHam(Ham_TakeDamage, a, g_iM4A1, attacker, damage); } } } set_pev(ent, pev_flags, FL_KILLME) remove_task(ent+TASK_SEEK_CATCH) }}