引用 | 編輯
luo105575
2011-05-08 19:26 |
樓主
|
||
x0
这是可以在地图里布置1个音乐播放器的插件 这个插件有点不足的地方就是在地图里布置了播放器以后 如果刷新地图的话需要重新再设置 不能保存到游戏里面 希望改进下 就像和可以在地图里设置图片广告那个插件一样的。 #include <amxmodx> #include <amxmisc> #include <engine> public Ass_CreateRadio(id,level,cid){ if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED if(entity_get_int(id, EV_INT_deadflag) != 0) return PLUGIN_HANDLED new Float:vOrigin[3] new Float:vAngles[3] entity_get_vector(id, EV_VEC_origin, vOrigin) entity_get_vector(id, EV_VEC_v_angle, vAngles) new NewEnt NewEnt = create_entity("info_target") if(NewEnt == 0) { return PLUGIN_HANDLED_MAIN } entity_set_string(NewEnt, EV_SZ_classname, "ass_radio") entity_set_model(NewEnt, "models/w_transistor.mdl") entity_set_int(NewEnt, EV_INT_body, 1) entity_set_int(NewEnt, EV_INT_sequence, 1) entity_set_int(NewEnt, EV_INT_solid, 2) new Float:MinBox[3] new Float:MaxBox[3] MinBox[0] = -8.0 MinBox[1] = -8.0 MinBox[2] = -8.0 MaxBox[0] = 8.0 MaxBox[1] = 8.0 MaxBox[2] = 8.0 entity_set_vector(NewEnt, EV_VEC_mins, MinBox) entity_set_vector(NewEnt, EV_VEC_maxs, MaxBox) new Float:vNewOrigin[3] new Float:vNormal[3] new Float:vTraceDirection[3] new Float:vTraceEnd[3] new Float:vTraceResult[3] new Float:vEntAngles[3] VelocityByAim(id, 64, vTraceDirection) vTraceEnd[0] = vTraceDirection[0] + vOrigin[0] vTraceEnd[1] = vTraceDirection[1] + vOrigin[1] vTraceEnd[2] = vTraceDirection[2] + vOrigin[2] trace_line(id, vOrigin, vTraceEnd, vTraceResult) if(trace_normal(id, vOrigin, vTraceEnd, vNormal) == 0) { remove_entity(NewEnt) console_print(id, "[Radio] You must plant the radio on a wall!") return PLUGIN_HANDLED_MAIN } vNewOrigin[0] = vTraceResult[0] + (vNormal[0] * 8.0) vNewOrigin[1] = vTraceResult[1] + (vNormal[1] * 8.0) vNewOrigin[2] = vTraceResult[2] + (vNormal[2] * 8.0) entity_set_origin(NewEnt, vNewOrigin) vector_to_angle(vNormal, vEntAngles) entity_set_vector(NewEnt, EV_VEC_angles, vEntAngles) new Float:vBeamEnd[3] new Float:vTracedBeamEnd[3] vBeamEnd[0] = vNewOrigin[0] + (vNormal[0] * 8192) vBeamEnd[1] = vNewOrigin[1] + (vNormal[1] * 8192) vBeamEnd[2] = vNewOrigin[2] + (vNormal[2] * 8192) trace_line(-1, vNewOrigin, vBeamEnd, vTracedBeamEnd) entity_set_vector(NewEnt, EV_VEC_vuser1, vTracedBeamEnd) entity_set_int(NewEnt, EV_INT_movetype, 5) //5 = movetype_fly, No grav, but collides. emit_sound(NewEnt, CHAN_WEAPON, "weapons/mine_deploy.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) new args[4] num_to_str(NewEnt, args, 4) set_task(3.0, "RadioActivate", 0, args, 4) return PLUGIN_HANDLED_MAIN } public RadioActivate(RadioID[]) { new EntID = str_to_num(RadioID) new Station = get_cvar_num("radio_station") if (Station==1) { emit_sound(EntID, CHAN_VOICE, "ambience/arabmusic.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(107.0, "StartSoundAgain", EntID+22) } else if (Station==2) { emit_sound(EntID, CHAN_VOICE, "ambience/Opera.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(72.0, "StartSoundAgain", EntID+22) } else { emit_sound(EntID, CHAN_VOICE, "ambience/lv_jubilee.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(6.0, "StartSoundAgain", EntID+22) } } public StartSoundAgain(TaskID) { new EntID = TaskID-22 new Station = get_cvar_num("radio_station") if (Station==1) { emit_sound(EntID, CHAN_VOICE, "ambience/arabmusic.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(107.0, "StartSoundAgain", EntID+22) } else if (Station==2) { emit_sound(EntID, CHAN_VOICE, "ambience/Opera.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(72.0, "StartSoundAgain", EntID+22) } else { emit_sound(EntID, CHAN_VOICE, "ambience/lv_jubilee.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(6.0, "StartSoundAgain", EntID+22) } } public Ass_DelRadios(id,level,cid){ if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED new iEntity = find_ent_by_class(-1, "ass_radio") while(iEntity > 0) { emit_sound(iEntity, CHAN_VOICE, "common/null.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) remove_task(iEntity+22) remove_entity(iEntity) iEntity = find_ent_by_class(-1, "ass_radio") } return PLUGIN_CONTINUE } public Ass_ResRadios(id,level,cid){ if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED new iEntity = find_ent_by_class(-1, "ass_radio") while(iEntity > 0) { remove_task(iEntity+22) emit_sound(iEntity, CHAN_VOICE, "common/null.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_task(3.0, "StartSoundAgain", iEntity+22) iEntity = find_ent_by_class(iEntity, "ass_radio") } return PLUGIN_CONTINUE } public plugin_init(){ register_plugin("Trasistor Radio","1.0","AssKicR") register_clcmd("amx_setradio","Ass_CreateRadio",ADMIN_KICK) register_clcmd("amx_delradios","Ass_DelRadios",ADMIN_KICK) register_clcmd("amx_resradios","Ass_ResRadios",ADMIN_KICK) register_cvar("radio_station","1") return PLUGIN_CONTINUE } public plugin_precache() { precache_sound("weapons/mine_deploy.wav") // Radio Place precache_sound("common/null.wav") // Radio Off precache_sound("ambience/arabmusic.wav") // Jihad Channel (1) precache_sound("ambience/Opera.wav") // Opera Channel (2) precache_sound("ambience/lv_jubilee.wav") // New Wave Channel (3) precache_model("models/w_transistor.mdl") precache_model("models/w_transistort.mdl") return PLUGIN_CONTINUE } 第2个插件 是1个死亡的声音效果 被敌人杀死的时候队友能听见你的声音 改成在你被杀的地方的人可以听到你死亡的声音包括杀你的人 如果离的太远的人是听不见的 #include <amxmod> new PLUGIN_NAME[] = "Death Voice" new PLUGIN_AUTHOR[] = "Cheap_Suit" new PLUGIN_VERSION[] = "1.2" public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) register_event("DeathMsg", "Event_Death", "a") } public plugin_precache() { precache_sound("misc/solder_deat.wav") } public Event_Death() { new victim = read_data(2) new victimTeam[16] get_user_team(victim, victimTeam, 15) new players[32], playerCnt get_players(players, playerCnt, "ae", victimTeam) for(new i = 0; i < playerCnt; i++) { client_cmd(players, "spk misc/solder_deat.wav") } } x0
|