Advertisement
Guest User

Rockguitar sa 1 round

a guest
Jul 30th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.74 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <fun>
  5. #include <hamsandwich>
  6. #include <xs>
  7. #include <cstrike>
  8. #include <zombieplague>
  9.  
  10. #define ENG_NULLENT -1
  11. #define EV_INT_WEAPONKEY EV_INT_impulse
  12. #define ROCKGUITAR_WEAPONKEY 705
  13. #define MAX_PLAYERS 32
  14. const USE_STOPPED = 0
  15. const OFFSET_ACTIVE_ITEM = 373
  16. const OFFSET_WEAPONOWNER = 41
  17. const OFFSET_LINUX = 5
  18. const OFFSET_LINUX_WEAPONS = 4
  19. #define WEAP_LINUX_XTRA_OFF 4
  20. #define m_fKnown 44
  21. #define m_flNextPrimaryAttack 46
  22. #define m_flTimeWeaponIdle 48
  23. #define m_iClip 51
  24. #define m_fInReload 54
  25. #define PLAYER_LINUX_XTRA_OFF 5
  26. #define m_flNextAttack 83
  27. #define ROCKGUITAR_RELOAD_TIME 2.5
  28. const PRIMARY_WEAPONS_BIT_SUM =
  29. (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<
  30. CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
  31. new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
  32. "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
  33. "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
  34. "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
  35. "weapon_ak47", "weapon_knife", "weapon_p90" }
  36.  
  37. new const Sound_Fire[][] = { "weapons/rguitar.wav" }
  38. new const Sound_Zoom[] = { "weapons/zoom.wav" }
  39. new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }
  40. new ROCKGUITAR_V_MODEL[64] = "models/v_RockGuitar.mdl"
  41. new ROCKGUITAR_P_MODEL[64] = "models/p_RockGuitar.mdl"
  42. new ROCKGUITAR_W_MODEL[64] = "models/w_RockGuitar.mdl"
  43. new cvar_dmg_RockGuitar, cvar_recoil_RockGuitar, g_itemid_RockGuitar, cvar_clip_RockGuitar, cvar_spd_RockGuitar, cvar_RockGuitar_ammo
  44. new g_has_RockGuitar[33], g_MaxPlayers, Float:cl_pushangle[MAX_PLAYERS + 1][3], m_iBlood[2], g_hasZoom[33],
  45. g_orig_event_RockGuitar, g_IsInPrimaryAttack, g_clip_ammo[33], g_RockGuitar_TmpClip[33]
  46.  
  47. public plugin_init()
  48. {
  49. register_plugin("[ZP] Extra: New Weapons", "1.0", "=)")
  50. register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
  51. register_event("CurWeapon","CurrentWeapon","be","1=1")
  52. RegisterHam(Ham_Item_AddToPlayer, "weapon_galil", "fw_Aug_AddToPlayer")
  53. RegisterHam(Ham_Use, "func_tank", "fw_UseStationary_Post", 1)
  54. RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary_Post", 1)
  55. RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary_Post", 1)
  56. RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary_Post", 1)
  57. for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
  58. if (WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "fw_Item_Deploy_Post", 1)
  59. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "fw_Aug_PrimaryAttack")
  60. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_galil", "fw_Aug_PrimaryAttack_Post", 1)
  61. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  62. RegisterHam(Ham_Item_PostFrame, "weapon_galil", "ROCKGUITAR__ItemPostFrame");
  63. RegisterHam(Ham_Weapon_Reload, "weapon_galil", "ROCKGUITAR__Reload");
  64. RegisterHam(Ham_Weapon_Reload, "weapon_galil", "ROCKGUITAR__Reload_Post", 1);
  65. register_forward(FM_SetModel, "fw_SetModel")
  66. register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  67. register_forward(FM_PlaybackEvent, "fwPlaybackEvent")
  68. register_forward(FM_CmdStart, "fw_CmdStart")
  69. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  70. cvar_dmg_RockGuitar = register_cvar("zp_RockGuitar_dmg", "1.2")
  71. cvar_recoil_RockGuitar = register_cvar("zp_RockGuitar_recoil", "0.5")
  72. cvar_clip_RockGuitar = register_cvar("zp_RockGuitar_clip", "60")
  73. cvar_spd_RockGuitar = register_cvar("zp_RockGuitar_spd", "1.0")
  74. cvar_RockGuitar_ammo = register_cvar("zp_RockGuitar_ammo", "180")
  75.  
  76. g_itemid_RockGuitar = zp_register_extra_item("RockGuitar", 70, ZP_TEAM_HUMAN)
  77. g_MaxPlayers = get_maxplayers()
  78. }
  79.  
  80. public plugin_precache()
  81. {
  82. precache_model(ROCKGUITAR_V_MODEL)
  83. precache_model(ROCKGUITAR_P_MODEL)
  84. precache_model(ROCKGUITAR_W_MODEL)
  85. precache_sound("weapons/gt_clipout.wav")
  86. precache_sound("weapons/gt_draw.wav")
  87. precache_sound("weapons/gt_clipin.wav")
  88. precache_sound("weapons/gt_clipon.wav")
  89. for(new i = 0; i < sizeof Sound_Fire; i++)
  90. precache_sound(Sound_Fire[i])
  91. m_iBlood[0] = precache_model("sprites/blood.spr")
  92. m_iBlood[1] = precache_model("sprites/bloodspray.spr")
  93.  
  94. register_forward(FM_PrecacheEvent, "fwPrecacheEvent_Post", 1)
  95. }
  96.  
  97. public zp_user_humanized_post(id)
  98. {
  99. g_has_RockGuitar[id] = false
  100. }
  101.  
  102. public fwPrecacheEvent_Post(type, const name[])
  103. {
  104. if (equal("events/galil.sc", name))
  105. {
  106. g_orig_event_RockGuitar = get_orig_retval()
  107. return FMRES_HANDLED
  108. }
  109.  
  110. return FMRES_IGNORED
  111. }
  112.  
  113. public client_connect(id)
  114. {
  115. g_has_RockGuitar[id] = false
  116. }
  117.  
  118. public client_disconnect(id)
  119. {
  120. g_has_RockGuitar[id] = false
  121. }
  122.  
  123. public zp_user_infected_post(id)
  124. {
  125. if (zp_get_user_zombie(id))
  126. {
  127. g_has_RockGuitar[id] = false
  128. }
  129. }
  130. public event_round_start()
  131. {
  132. new players[32], num
  133. get_players(players, num)
  134.  
  135. for (new id; id < num; id++)
  136. {
  137. g_has_RockGuitar[id] = false
  138. }
  139. }
  140. public fw_SetModel(entity, model[])
  141. {
  142. if(!is_valid_ent(entity))
  143. return FMRES_IGNORED;
  144.  
  145. static szClassName[33]
  146. entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  147.  
  148. if(!equal(szClassName, "weaponbox"))
  149. return FMRES_IGNORED;
  150.  
  151. static iOwner
  152.  
  153. iOwner = entity_get_edict(entity, EV_ENT_owner)
  154.  
  155. if(equal(model, "models/w_galil.mdl"))
  156. {
  157. static iStoredAugID
  158.  
  159. iStoredAugID = find_ent_by_owner(ENG_NULLENT, "weapon_galil", entity)
  160.  
  161. if(!is_valid_ent(iStoredAugID))
  162. return FMRES_IGNORED;
  163.  
  164. if(g_has_RockGuitar[iOwner])
  165. {
  166. entity_set_int(iStoredAugID, EV_INT_WEAPONKEY, ROCKGUITAR_WEAPONKEY)
  167.  
  168. g_has_RockGuitar[iOwner] = false
  169.  
  170. entity_set_model(entity, ROCKGUITAR_W_MODEL)
  171.  
  172. return FMRES_SUPERCEDE;
  173. }
  174. }
  175.  
  176. return FMRES_IGNORED;
  177. }
  178.  
  179. public zp_extra_item_selected(id, itemid)
  180. {
  181. if(itemid == g_itemid_RockGuitar)
  182. {
  183. drop_weapons(id, 1);
  184. new iWep2 = give_item(id,"weapon_galil")
  185. if( iWep2 > 0 )
  186. {
  187. cs_set_weapon_ammo( iWep2, get_pcvar_num(cvar_clip_RockGuitar) )
  188. cs_set_user_bpammo (id, CSW_GALIL, get_pcvar_num(cvar_RockGuitar_ammo))
  189. UTIL_PlayWeaponAnimation(id, 2)
  190. }
  191. g_has_RockGuitar[id] = true;
  192. }
  193. }
  194.  
  195. public fw_Aug_AddToPlayer(Aug, id)
  196. {
  197. if(!is_valid_ent(Aug) || !is_user_connected(id))
  198. return HAM_IGNORED;
  199.  
  200. if(entity_get_int(Aug, EV_INT_WEAPONKEY) == ROCKGUITAR_WEAPONKEY)
  201. {
  202. g_has_RockGuitar[id] = true
  203.  
  204. entity_set_int(Aug, EV_INT_WEAPONKEY, 0)
  205.  
  206. return HAM_HANDLED;
  207. }
  208.  
  209. return HAM_IGNORED;
  210. }
  211.  
  212. public fw_UseStationary_Post(entity, caller, activator, use_type)
  213. {
  214. if (use_type == USE_STOPPED && is_user_connected(caller))
  215. replace_weapon_models(caller, get_user_weapon(caller))
  216. }
  217.  
  218. public fw_Item_Deploy_Post(weapon_ent)
  219. {
  220. static owner
  221. owner = fm_cs_get_weapon_ent_owner(weapon_ent)
  222.  
  223. static weaponid
  224. weaponid = cs_get_weapon_id(weapon_ent)
  225.  
  226. replace_weapon_models(owner, weaponid)
  227. }
  228.  
  229. public CurrentWeapon(id)
  230. {
  231. replace_weapon_models(id, read_data(2))
  232.  
  233. if(read_data(2) != CSW_GALIL || !g_has_RockGuitar[id])
  234. return
  235.  
  236. static Float:iSpeed
  237. if(g_has_RockGuitar[id])
  238. iSpeed = get_pcvar_float(cvar_spd_RockGuitar)
  239.  
  240. static weapon[32],Ent
  241. get_weaponname(read_data(2),weapon,31)
  242. Ent = find_ent_by_owner(-1,weapon,id)
  243. if(Ent)
  244. {
  245. static Float:Delay
  246. Delay = get_pdata_float( Ent, 46, 4) * iSpeed
  247. if (Delay > 0.0)
  248. {
  249. set_pdata_float(Ent, 46, Delay, 4)
  250. }
  251. }
  252. }
  253.  
  254. replace_weapon_models(id, weaponid)
  255. {
  256. switch (weaponid)
  257. {
  258. case CSW_GALIL:
  259. {
  260. if (zp_get_user_zombie(id) || zp_get_user_survivor(id))
  261. return;
  262.  
  263. if(g_has_RockGuitar[id])
  264. {
  265. set_pev(id, pev_viewmodel2, ROCKGUITAR_V_MODEL)
  266. set_pev(id, pev_weaponmodel2, ROCKGUITAR_P_MODEL)
  267. }
  268. }
  269. }
  270. }
  271.  
  272. public fw_UpdateClientData_Post(Player, SendWeapons, CD_Handle)
  273. {
  274. if(!is_user_alive(Player) || (get_user_weapon(Player) != CSW_GALIL || !g_has_RockGuitar[Player]))
  275.  
  276. return FMRES_IGNORED
  277.  
  278. set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
  279. return FMRES_HANDLED
  280. }
  281.  
  282. public fw_Aug_PrimaryAttack(Weapon)
  283. {
  284. new Player = get_pdata_cbase(Weapon, 41, 4)
  285.  
  286. if (!g_has_RockGuitar[Player])
  287. return;
  288.  
  289. g_IsInPrimaryAttack = 1
  290. pev(Player,pev_punchangle,cl_pushangle[Player])
  291.  
  292. g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon)
  293. }
  294.  
  295. public fwPlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
  296. {
  297. if ((eventid != g_orig_event_RockGuitar) || !g_IsInPrimaryAttack)
  298. return FMRES_IGNORED
  299. if (!(1 <= invoker <= g_MaxPlayers))
  300. return FMRES_IGNORED
  301.  
  302. playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
  303. return FMRES_SUPERCEDE
  304. }
  305.  
  306. public fw_Aug_PrimaryAttack_Post(Weapon)
  307. {
  308. g_IsInPrimaryAttack = 0
  309. new Player = get_pdata_cbase(Weapon, 41, 4)
  310.  
  311. if(g_has_RockGuitar[Player])
  312. {
  313. new Float:push[3]
  314. pev(Player,pev_punchangle,push)
  315. xs_vec_sub(push,cl_pushangle[Player],push)
  316.  
  317. xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil_RockGuitar),push)
  318. xs_vec_add(push,cl_pushangle[Player],push)
  319. set_pev(Player,pev_punchangle,push)
  320.  
  321. if (!g_clip_ammo[Player])
  322. return
  323.  
  324. emit_sound(Player, CHAN_WEAPON, Sound_Fire[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  325. UTIL_PlayWeaponAnimation(Player, random_num(3, 4))
  326.  
  327. make_blood_and_bulletholes(Player)
  328. }
  329. }
  330.  
  331. public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
  332. {
  333. if (victim != attacker && is_user_connected(attacker))
  334. {
  335. if(get_user_weapon(attacker) == CSW_GALIL)
  336. {
  337. if(g_has_RockGuitar[attacker])
  338. SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmg_RockGuitar))
  339. }
  340. }
  341. }
  342.  
  343. public message_DeathMsg(msg_id, msg_dest, id)
  344. {
  345. static szTruncatedWeapon[33], iAttacker, iVictim
  346.  
  347. get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  348.  
  349. iAttacker = get_msg_arg_int(1)
  350. iVictim = get_msg_arg_int(2)
  351.  
  352. if(!is_user_connected(iAttacker) || iAttacker == iVictim)
  353. return PLUGIN_CONTINUE
  354.  
  355. if(equal(szTruncatedWeapon, "galil") && get_user_weapon(iAttacker) == CSW_GALIL)
  356. {
  357. if(g_has_RockGuitar[iAttacker])
  358. set_msg_arg_string(4, "RockGuitar")
  359. }
  360.  
  361. return PLUGIN_CONTINUE
  362. }
  363.  
  364. stock fm_cs_get_current_weapon_ent(id)
  365. {
  366. return get_pdata_cbase(id, OFFSET_ACTIVE_ITEM, OFFSET_LINUX);
  367. }
  368.  
  369. stock fm_cs_get_weapon_ent_owner(ent)
  370. {
  371. return get_pdata_cbase(ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS);
  372. }
  373.  
  374. stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
  375. {
  376. set_pev(Player, pev_weaponanim, Sequence)
  377.  
  378. message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
  379. write_byte(Sequence)
  380. write_byte(pev(Player, pev_body))
  381. message_end()
  382. }
  383.  
  384. stock make_blood_and_bulletholes(id)
  385. {
  386. new aimOrigin[3], target, body
  387. get_user_origin(id, aimOrigin, 3)
  388. get_user_aiming(id, target, body)
  389.  
  390. if(target > 0 && target <= g_MaxPlayers && zp_get_user_zombie(target))
  391. {
  392. new Float:fStart[3], Float:fEnd[3], Float:fRes[3], Float:fVel[3]
  393. pev(id, pev_origin, fStart)
  394.  
  395. velocity_by_aim(id, 64, fVel)
  396.  
  397. fStart[0] = float(aimOrigin[0])
  398. fStart[1] = float(aimOrigin[1])
  399. fStart[2] = float(aimOrigin[2])
  400. fEnd[0] = fStart[0]+fVel[0]
  401. fEnd[1] = fStart[1]+fVel[1]
  402. fEnd[2] = fStart[2]+fVel[2]
  403.  
  404. new res
  405. engfunc(EngFunc_TraceLine, fStart, fEnd, 0, target, res)
  406. get_tr2(res, TR_vecEndPos, fRes)
  407.  
  408. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  409. write_byte(TE_BLOODSPRITE)
  410. write_coord(floatround(fStart[0]))
  411. write_coord(floatround(fStart[1]))
  412. write_coord(floatround(fStart[2]))
  413. write_short( m_iBlood [ 1 ])
  414. write_short( m_iBlood [ 0 ] )
  415. write_byte(70)
  416. write_byte(random_num(1,2))
  417. message_end()
  418.  
  419.  
  420. }
  421. else if(!is_user_connected(target))
  422. {
  423. if(target)
  424. {
  425. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  426. write_byte(TE_DECAL)
  427. write_coord(aimOrigin[0])
  428. write_coord(aimOrigin[1])
  429. write_coord(aimOrigin[2])
  430. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  431. write_short(target)
  432. message_end()
  433. }
  434. else
  435. {
  436. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  437. write_byte(TE_WORLDDECAL)
  438. write_coord(aimOrigin[0])
  439. write_coord(aimOrigin[1])
  440. write_coord(aimOrigin[2])
  441. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  442. message_end()
  443. }
  444.  
  445. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  446. write_byte(TE_GUNSHOTDECAL)
  447. write_coord(aimOrigin[0])
  448. write_coord(aimOrigin[1])
  449. write_coord(aimOrigin[2])
  450. write_short(id)
  451. write_byte(GUNSHOT_DECALS[random_num ( 0, sizeof GUNSHOT_DECALS -1 ) ] )
  452. message_end()
  453. }
  454. }
  455.  
  456. public ROCKGUITAR__ItemPostFrame(weapon_entity)
  457. {
  458. new id = pev(weapon_entity, pev_owner)
  459. if (!is_user_connected(id))
  460. return HAM_IGNORED;
  461.  
  462. if (!g_has_RockGuitar[id])
  463. return HAM_IGNORED;
  464.  
  465. static iClipExtra
  466.  
  467. if(g_has_RockGuitar[id])
  468. iClipExtra = get_pcvar_num(cvar_clip_RockGuitar)
  469.  
  470. new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, PLAYER_LINUX_XTRA_OFF)
  471.  
  472. new iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL);
  473. new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)
  474.  
  475. new fInReload = get_pdata_int(weapon_entity, m_fInReload, WEAP_LINUX_XTRA_OFF)
  476.  
  477. if( fInReload && flNextAttack <= 0.0 )
  478. {
  479. new j = min(iClipExtra - iClip, iBpAmmo)
  480.  
  481. set_pdata_int(weapon_entity, m_iClip, iClip + j, WEAP_LINUX_XTRA_OFF)
  482. cs_set_user_bpammo(id, CSW_GALIL, iBpAmmo-j);
  483.  
  484. set_pdata_int(weapon_entity, m_fInReload, 0, WEAP_LINUX_XTRA_OFF)
  485. fInReload = 0
  486. }
  487.  
  488. return HAM_IGNORED;
  489. }
  490.  
  491. public ROCKGUITAR__Reload(weapon_entity)
  492. {
  493. new id = pev(weapon_entity, pev_owner)
  494. if (!is_user_connected(id))
  495. return HAM_IGNORED;
  496.  
  497. if (!g_has_RockGuitar[id])
  498. return HAM_IGNORED;
  499.  
  500. static iClipExtra
  501.  
  502. if(g_has_RockGuitar[id])
  503. iClipExtra = get_pcvar_num(cvar_clip_RockGuitar)
  504.  
  505. g_RockGuitar_TmpClip[id] = -1;
  506.  
  507. new iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL);
  508. new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)
  509.  
  510. if (iBpAmmo <= 0)
  511. return HAM_SUPERCEDE;
  512.  
  513. if (iClip >= iClipExtra)
  514. return HAM_SUPERCEDE;
  515.  
  516.  
  517. g_RockGuitar_TmpClip[id] = iClip;
  518.  
  519. return HAM_IGNORED;
  520. }
  521.  
  522. public ROCKGUITAR__Reload_Post(weapon_entity)
  523. {
  524. new id = pev(weapon_entity, pev_owner)
  525. if (!is_user_connected(id))
  526. return HAM_IGNORED;
  527.  
  528. if (!g_has_RockGuitar[id])
  529. return HAM_IGNORED;
  530.  
  531. if (g_RockGuitar_TmpClip[id] == -1)
  532. return HAM_IGNORED;
  533.  
  534. static Float:iReloadTime
  535. if(g_has_RockGuitar[id])
  536. iReloadTime = ROCKGUITAR_RELOAD_TIME
  537.  
  538. set_pdata_int(weapon_entity, m_iClip, g_RockGuitar_TmpClip[id], WEAP_LINUX_XTRA_OFF)
  539.  
  540. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, iReloadTime, WEAP_LINUX_XTRA_OFF)
  541.  
  542. set_pdata_float(id, m_flNextAttack, iReloadTime, PLAYER_LINUX_XTRA_OFF)
  543.  
  544. set_pdata_int(weapon_entity, m_fInReload, 1, WEAP_LINUX_XTRA_OFF)
  545.  
  546. UTIL_PlayWeaponAnimation(id, 1)
  547.  
  548. return HAM_IGNORED;
  549. }
  550.  
  551. public fw_CmdStart(id, uc_handle, seed)
  552. {
  553. if(!is_user_alive(id))
  554. return PLUGIN_HANDLED
  555.  
  556. if((get_uc(uc_handle, UC_Buttons) & IN_ATTACK2) && !(pev(id, pev_oldbuttons) & IN_ATTACK2))
  557. {
  558. new szClip, szAmmo
  559. new szWeapID = get_user_weapon(id, szClip, szAmmo)
  560.  
  561. if(szWeapID == CSW_GALIL && g_has_RockGuitar[id] && !g_hasZoom[id] == true)
  562. {
  563. g_hasZoom[id] = true
  564. cs_set_user_zoom(id, CS_SET_AUGSG552_ZOOM, 1)
  565. emit_sound(id, CHAN_ITEM, Sound_Zoom, 0.20, 2.40, 0, 100)
  566. }
  567.  
  568. else if(szWeapID == CSW_GALIL && g_has_RockGuitar[id] && g_hasZoom[id])
  569. {
  570. g_hasZoom[id] = false
  571. cs_set_user_zoom(id, CS_RESET_ZOOM, 0)
  572.  
  573. }
  574.  
  575. }
  576.  
  577. if (g_hasZoom[ id ] && (pev(id, pev_button) & IN_RELOAD))
  578. {
  579. g_hasZoom[ id ] = false
  580. cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
  581. }
  582. return PLUGIN_HANDLED
  583. }
  584.  
  585. stock drop_weapons(id, dropwhat)
  586. {
  587. static weapons[32], num, i, weaponid
  588. num = 0
  589. get_user_weapons(id, weapons, num)
  590.  
  591. for (i = 0; i < num; i++)
  592. {
  593. weaponid = weapons[i]
  594.  
  595. if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
  596. {
  597. static wname[32]
  598. get_weaponname(weaponid, wname, sizeof wname - 1)
  599. engclient_cmd(id, "drop", wname)
  600. }
  601. }
  602. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement