|
楼主 |
发表于 2010-10-1 04:08:28
|
显示全部楼层
来自 中国–广西–桂林
- /* 本插件由 AMXX-Studio 中文版自动生成*/
- /* UTF-8 func by www.DT-Club.net */
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <fakemeta_util>
- #include <hamsandwich>
- #define PLUGIN_NAME "New Plug-In"
- #define PLUGIN_VERSION "1.0"
- #define PLUGIN_AUTHOR "Love灬Weiwei"
- #define WEAPON_CSW CSW_M4A1
- #define WEAPON_ENT "weapon_m4a1"
- #define WEAPON_RELOAD_TIME 4.0
- #define WEAPON_DRAW_TIME 2.0
- #define WEAPON_ADDSIL_TIME 1.8
- #define WEAPON_SHOOT_TIME 2.2
- #define TASK_SHOOT 1234
- enum {
- anim_idle,
- anim_reload,
- anim_draw,
- anim_shoot1,
- anim_shoot2,
- anim_shoot3,
- anim_add,
- anim_idle_unsil,
- }
- new g_reloading[33],g_addsil[33],g_shooting[33],g_hasDoneCurWeap[33]
- const m_pPlayer = 41 //用于寻找实体主人
- const m_flNextPrimaryAttack = 46
- public plugin_init()
- {
- register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
- register_forward(FM_CmdStart, "forward_cmdstart")
- register_forward(FM_UpdateClientData, "UpdateClientData_Post", 1)
-
- register_event("CurWeapon","Current_Weapon","be","1=1")
-
- RegisterHam(Ham_Weapon_PrimaryAttack, WEAPON_ENT, "fw_WeapPriAttack", 1)
- RegisterHam(Ham_Weapon_Reload, WEAPON_ENT, "fw_WeaponReload",1);
- RegisterHam(Ham_Item_Deploy, WEAPON_ENT, "fw_WeaponDeployPost", 1);
-
- //在此处添加您的代码...
- }
- public native_playanim(player,anim)
- {
- set_pev(player, pev_weaponanim, anim)
- message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, player)
- write_byte(anim)
- write_byte(pev(player, pev_body))
- message_end()
- }
- public forward_cmdstart(id, uc_handle, seed)
- {
- if(!is_user_alive(id) || get_user_weapon(id) != WEAPON_CSW)
- return PLUGIN_HANDLED
-
- if((get_uc(uc_handle, UC_Buttons) & IN_ATTACK2) && !(pev(id, pev_oldbuttons) & IN_ATTACK2) )
- {
- if(!g_reloading[id] && !g_addsil[id])
- {
- if(cs_get_user_zoom(id) == CS_SET_AUGSG552_ZOOM)
- {
- cs_set_user_zoom(id,CS_RESET_ZOOM,1)
- }
- else
- {
- cs_set_user_zoom(id,CS_SET_AUGSG552_ZOOM,1)
- }
-
- emit_sound(id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100)
- }
- }
-
- if( get_uc(uc_handle, UC_Impulse) == 201 && !g_reloading[id] && !g_addsil[id] && !g_shooting[id])
- {
- cs_set_user_zoom(id, CS_RESET_ZOOM, 0)
-
- remove_task(id)
- g_addsil[id] = true
- set_task(WEAPON_ADDSIL_TIME,"Finish_addSil",id)
-
- new ent = fm_find_ent_by_owner(-1, WEAPON_ENT,id)
-
- if(cs_get_weapon_silen(ent))
- {
- cs_set_weapon_silen(ent,0,1)
- }
-
- else
- {
- cs_set_weapon_silen(ent,1,1)
- }
-
- }
- new cmd
-
- if(g_addsil[id])
- {
- if((cmd = get_uc(uc_handle, UC_Buttons)) & IN_ATTACK )
- {
- cmd &= ~IN_ATTACK
- set_uc(uc_handle, UC_Buttons, cmd)
- }
-
- if((cmd = get_uc(uc_handle, UC_Buttons)) & IN_RELOAD )
- {
- cmd &= ~IN_RELOAD
- set_uc(uc_handle, UC_Buttons, cmd)
- }
- }
-
- if((cmd = get_uc(uc_handle, UC_Buttons)) & IN_ATTACK2 )
- {
- cmd &= ~IN_ATTACK2
- set_uc(uc_handle, UC_Buttons, cmd)
- }
-
-
- return PLUGIN_HANDLED
- }
- public Finish_WeapReload(id)
- {
- g_reloading[id] = false
-
- }
- public Finish_addSil(id)
- {
- g_addsil[id] = false
-
- if(is_user_alive(id) && get_user_weapon(id) == WEAPON_CSW)
- {
- new ent = fm_find_ent_by_owner(-1, WEAPON_ENT,id)
-
- if(cs_get_weapon_silen(ent))
- native_playanim(id,anim_idle)
- else
- native_playanim(id,anim_idle_unsil)
- }
- }
- public Finish_shoot(taskid)
- {
- new id = taskid-TASK_SHOOT
-
- g_shooting[id] = false
- }
- public Current_Weapon(id)
- {
- if(!g_hasDoneCurWeap[id] && get_user_weapon(id) != WEAPON_CSW)
- {
- remove_task(id)
- remove_task(id+TASK_SHOOT)
- g_reloading[id] = false
- g_addsil[id] = false
- g_shooting[id] = false
- g_hasDoneCurWeap[id] = true
- }
- }
- public UpdateClientData_Post( id, sendweapons, cd_handle )
- {
- if(!is_user_alive(id) || !g_addsil[id] || get_user_weapon(id) != WEAPON_CSW)
- return PLUGIN_HANDLED
-
- set_cd(cd_handle, CD_ID, 1);
-
- return PLUGIN_CONTINUE
- }
- public fw_WeaponReload(weapon)
- {
- static id;
- id = get_pdata_cbase(weapon, m_pPlayer, 4);
-
- cs_set_user_zoom(id, CS_RESET_ZOOM, 0)
-
- remove_task(id)
- g_reloading[id] = true
- set_task(WEAPON_RELOAD_TIME,"Finish_WeapReload",id)
- }
- public fw_WeaponDeployPost(weapon)
- {
- static id;
- id = get_pdata_cbase(weapon, m_pPlayer, 4);
-
- remove_task(id)
- g_reloading[id] = true
- set_task(WEAPON_DRAW_TIME,"Finish_WeapReload",id)
-
- g_hasDoneCurWeap[id] = false
-
- client_print(id,print_chat,"欢迎使用开镜精华,右键开镜,T键使用特殊功能。")
- }
- public fw_WeapPriAttack(weapon)
- {
- static id;
- id = get_pdata_cbase(weapon, m_pPlayer, 4);
-
- if(cs_get_user_zoom(id) == CS_SET_AUGSG552_ZOOM)
- {
- static Float:weap_delay
- weap_delay = get_pdata_float(weapon, 46, 4) * 1.5
-
- set_pdata_float(weapon, m_flNextPrimaryAttack, weap_delay, 4)
- }
-
- remove_task(id+TASK_SHOOT)
- g_shooting[id] = true
- set_task(WEAPON_SHOOT_TIME,"Finish_shoot",id+TASK_SHOOT)
- }
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
- */
复制代码 晕死真是没人帮新手的啊?? |
|