Code: Select all
public rpg_pre(weapon){ if (!is_valid_ent(weapon)) return PLUGIN_CONTINUE new id = entity_get_edict( weapon, EV_ENT_owner ) new ent new Float:where[3] new gmsgShake = get_user_msgid("ScreenShake") message_begin(MSG_ONE, gmsgShake, {0,0,0}, id) write_short(255<< 14 ) //ammount write_short(1 << 14) //lasts this long write_short(255<< 14) //frequency message_end() ent = create_entity("info_target") set_pev(ent, pev_classname, "rpg_missile") set_pev(ent, pev_solid, SOLID_TRIGGER) set_pev(ent, pev_movetype, MOVETYPE_BOUNCE) entity_set_model(ent, "models/rpgrocket.mdl") pev(id, pev_origin, where) where[2] += 50.0; where[0] += random_float(-20.0, 20.0) where[1] += random_float(-20.0, 20.0) entity_set_origin(ent, where) entity_get_vector(id,EV_VEC_angles,where) //where[1] = random_float(0.0, 180.0) entity_set_vector(ent, EV_VEC_angles, where) velocity_by_aim(id, 700, where) //entity_set_edict(ent, EV_ENT_aiment, id ); //where[2] += 200.0; entity_set_edict(ent,EV_ENT_owner,id) entity_set_vector(ent,EV_VEC_velocity,where) message_begin( MSG_BROADCAST, SVC_TEMPENTITY ) write_byte( TE_BEAMFOLLOW ) write_short(ent) // entity write_short(m_iTrail) // model write_byte( 10 ) // lifeffffff write_byte( 8 ) // width write_byte( 130) // r, g, b write_byte( 130 ) // r, g, b write_byte( 130 ) // r, g, b write_byte( 196 ) // brightness message_end() emit_sound(id, CHAN_WEAPON, _RpgSounds[0], 1.0, ATTN_NORM, 0, PITCH_NORM) emit_sound(ent, CHAN_WEAPON, _RpgSounds[2], 1.0, ATTN_NORM, 0, PITCH_NORM) RegisterHamFromEntity(Ham_Think,ent,"fw_rocket_think") set_pev(ent, pev_nextthink, get_gametime()+0.25); set_pdata_float( weapon , 46 , 2.5, 4 ); set_user_weaponanim(id, 2) //cs_set_weapon_ammo(gun, 2000) return HAM_SUPERCEDE}public fw_rocket_think(ent){ entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.25) new id = entity_get_edict( ent, EV_ENT_owner ) new Float:where[3] entity_get_vector(id,EV_VEC_angles,where) entity_set_vector(ent, EV_VEC_angles, where) velocity_by_aim(id, 700, where) entity_set_vector(ent,EV_VEC_velocity,where) return PLUGIN_CONTINUE}