hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.01. 17:03



Jelenlévő felhasználók

Jelenleg 309 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 308 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Google [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Extra cuccok
HozzászólásElküldve: 2013.02.23. 20:35 
Offline
Lelkes

Csatlakozott: 2013.02.05. 15:30
Hozzászólások: 19
Megköszönt másnak: 6 alkalommal
Megköszönték neki: 1 alkalommal
Hali!

Abban szeretnék segítséget kérni hogy ugye vannak az extra cuccok és vannak V.I.P extra cuccok azt szeretném megoldani hogy ha egy körben megvettem valamit akkor az a következő körben tűnjön el, ne maradjon az embernél.
Valaki tud ebben segíteni hogy mit írjak át?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Extra cuccok
HozzászólásElküldve: 2013.02.23. 20:38 
Offline
Beavatott
Avatar

Csatlakozott: 2013.02.20. 16:01
Hozzászólások: 74
Megköszönt másnak: 3 alkalommal
Megköszönték neki: 21 alkalommal
SMA-t linkeld!

_________________
Ha segítettem akkor nyomd meg a Köszönöm gombot! :)
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Extra cuccok
HozzászólásElküldve: 2013.02.23. 20:47 
Offline
Lelkes

Csatlakozott: 2013.02.05. 15:30
Hozzászólások: 19
Megköszönt másnak: 6 alkalommal
Megköszönték neki: 1 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. /*================================================================================
  2.  
  3. [ZP] Extra Item: Chainsaw
  4. Copyright (C) 2009 by meTaLiCroSS, Vińa del Mar, Chile
  5.  
  6. This program is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program. If not, see <http://www.gnu.org/licenses/>.
  18.  
  19. In addition, as a special exception, the author gives permission to
  20. link the code of this program with the Half-Life Game Engine ("HL
  21. Engine") and Modified Game Libraries ("MODs") developed by Valve,
  22. L.L.C ("Valve"). You must obey the GNU General Public License in all
  23. respects for all of the code used other than the HL Engine and MODs
  24. from Valve. If you modify this file, you may extend this exception
  25. to your version of the file, but you are not obligated to do so. If
  26. you do not wish to do so, delete this exception statement from your
  27. version.
  28.  
  29. ** Credits:
  30.  
  31. - B!gBud: Some code of his Jetpack + Bazooka
  32. - jtp10181: For his AMX Ultimate Gore plugin and good blood effects
  33.  
  34. =================================================================================*/
  35.  
  36. #include <amxmodx>
  37. #include <fakemeta>
  38. #include <engine>
  39. #include <hamsandwich>
  40. #include <zombieplague>
  41. #include <zmvip>
  42.  
  43. /*================================================================================
  44.  [Customization]
  45. =================================================================================*/
  46.  
  47. // Item Cost
  48. const chainsaw_ap_cost = 40 // Ammo packs Cost
  49.  
  50. // Custom Chainsaw Models
  51. new const chainsaw_viewmodel[] = "models/chainsaw/v_chainsaw.mdl" // View Weapon Model (v_)
  52. new const chainsaw_playermodel[] = "models/chainsaw/p_chainsaw.mdl" // Player Weapon Model (p_)
  53. new const chainsaw_worldmodel[] = "models/chainsaw/w_chainsaw.mdl" // World Weapon Model (w_)
  54.  
  55. // Custom Chainsaw Sounds
  56. new const chainsaw_sounds[][] =
  57. {
  58. "chainsaw/chainsaw_deploy.wav", // Deploy Sound (knife_deploy1.wav)
  59. "chainsaw/chainsaw_hit1.wav", // Hit 1 (knife_hit1.wav)
  60. "chainsaw/chainsaw_hit2.wav", // Hit 2 (knife_hit2.wav)
  61. "chainsaw/chainsaw_hit1.wav", // Hit 3 (knife_hit3.wav)
  62. "chainsaw/chainsaw_hit2.wav", // Hit 4 (knife_hit4.wav)
  63. "chainsaw/chainsaw_hitwall.wav", // Hit Wall (knife_hitwall1.wav)
  64. "chainsaw/chainsaw_miss.wav", // Slash 1 (knife_slash1.wav)
  65. "chainsaw/chainsaw_miss.wav", // Slash 2 (knife_slash2.wav)
  66. "chainsaw/chainsaw_stab.wav" // Stab (knife_stab1.wav)
  67. }
  68.  
  69. // Dropped Chainsaw Size
  70. new Float:chainsaw_mins[3] = { -2.0, -2.0, -2.0 }
  71. new Float:chainsaw_maxs[3] = { 2.0, 2.0, 2.0 }
  72.  
  73.  
  74. /*================================================================================
  75.  Customization ends here! Yes, that's it. Editing anything beyond
  76.  here is not officially supported. Proceed at your own risk...
  77. =================================================================================*/
  78.  
  79. // Variables
  80. new g_iItemID, g_msgCurWeapon, g_msgSayText
  81.  
  82. // Arrays
  83. new g_iHasChainsaw[33], g_iCurrentWeapon[33]
  84.  
  85. // Cvar Pointers
  86. new cvar_enable, cvar_dmgmult, cvar_oneround, cvar_sounds, cvar_dmggore, cvar_dropflags,
  87. cvar_pattack_rate, cvar_sattack_rate, cvar_pattack_recoil, cvar_sattack_recoil, cvar_body_xplode
  88.  
  89. // Flags
  90. const DROPFLAG_NORMAL = (1<<0) // "a", with "drop" clcmd (pressing G by default)
  91. const DROPFLAG_INDEATH = (1<<1) // "b", death victim
  92. const DROPFLAG_INFECTED = (1<<2) // "c", user infected
  93. const DROPFLAG_SURVHUMAN = (1<<3) // "d", user become survivor
  94.  
  95. // Offsets
  96. const m_pPlayer = 41
  97. const m_flNextPrimaryAttack = 46
  98. const m_flNextSecondaryAttack = 47
  99. const m_flTimeWeaponIdle = 48
  100.  
  101. // Old Knife Sounds (DON'T CHANGE)
  102. new const oldknife_sounds[][] =
  103. {
  104. "weapons/knife_deploy1.wav", // Deploy Sound
  105. "weapons/knife_hit1.wav", // Hit 1
  106. "weapons/knife_hit2.wav", // Hit 2
  107. "weapons/knife_hit3.wav", // Hit 3
  108. "weapons/knife_hit4.wav", // Hit 4
  109. "weapons/knife_hitwall1.wav", // Hit Wall
  110. "weapons/knife_slash1.wav", // Slash 1
  111. "weapons/knife_slash2.wav", // Slash 2
  112. "weapons/knife_stab.wav" // Stab
  113. }
  114.  
  115. // Plug info.
  116. #define PLUG_VERSION "0.9"
  117. #define PLUG_AUTH "meTaLiCroSS"
  118.  
  119. /*================================================================================
  120.  [Init and Precache]
  121. =================================================================================*/
  122.  
  123. public plugin_init()
  124. {
  125. // Plugin Register
  126. register_plugin("[ZP] Extra Item: Chainsaw", PLUG_VERSION, PLUG_AUTH)
  127.  
  128. // Events
  129. register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0")
  130. register_event("CurWeapon", "event_CurWeapon", "b", "1=1")
  131.  
  132. // Cvars
  133. cvar_enable = register_cvar("zp_chainsaw_enable", "1")
  134. cvar_sounds = register_cvar("zp_chainsaw_custom_sounds", "1")
  135. cvar_dmgmult = register_cvar("zp_chainsaw_damage_mult", "8.4")
  136. cvar_dmggore = register_cvar("zp_chainsaw_gore_in_damage", "1")
  137. cvar_oneround = register_cvar("zp_chainsaw_oneround", "0")
  138. cvar_dropflags = register_cvar("zp_chainsaw_drop_flags", "abcd")
  139. cvar_body_xplode = register_cvar("zp_chainsaw_victim_explode", "1")
  140. cvar_pattack_rate = register_cvar("zp_chainsaw_attack1_rate", "0.6")
  141. cvar_sattack_rate = register_cvar("zp_chainsaw_attack2_rate", "1.2")
  142. cvar_pattack_recoil = register_cvar("zp_chainsaw_attack1_recoil", "-5.6")
  143. cvar_sattack_recoil = register_cvar("zp_chainsaw_attack2_recoil", "-8.0")
  144.  
  145. new szCvar[30]
  146. formatex(szCvar, charsmax(szCvar), "v%s by %s", PLUG_VERSION, PLUG_AUTH)
  147. register_cvar("zp_extra_chainsaw", szCvar, FCVAR_SERVER|FCVAR_SPONLY)
  148.  
  149. // Fakemeta Forwards
  150. register_forward(FM_EmitSound, "fw_EmitSound")
  151.  
  152. // Engine Forwards
  153. register_touch("cs_chainsaw", "player", "fw_Chainsaw_Touch")
  154.  
  155. // Ham Forwards
  156. RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
  157. RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  158. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  159. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fw_Knife_PrimaryAttack_Post", 1)
  160. RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fw_Knife_SecondaryAttack_Post", 1)
  161.  
  162. // Variables
  163. g_iItemID = zv_register_extra_item("Lancfuresz", "Chansaw for cutting zombies", chainsaw_ap_cost, ZV_TEAM_HUMAN)
  164.  
  165. // Message ID's vars
  166. g_msgSayText = get_user_msgid("SayText")
  167. g_msgCurWeapon = get_user_msgid("CurWeapon")
  168.  
  169. // Client Commands
  170. register_clcmd("drop", "clcmd_drop")
  171. }
  172.  
  173. public plugin_precache()
  174. {
  175. // Models
  176. precache_model(chainsaw_viewmodel)
  177. precache_model(chainsaw_playermodel)
  178. precache_model(chainsaw_worldmodel)
  179.  
  180. // Sounds
  181. for(new i = 0; i < sizeof chainsaw_sounds; i++)
  182. precache_sound(chainsaw_sounds[i])
  183.  
  184. precache_sound("items/gunpickup2.wav")
  185. }
  186.  
  187. /*================================================================================
  188.  [Main Events]
  189. =================================================================================*/
  190.  
  191. public event_RoundStart()
  192. {
  193. // Remove chainsaws (entities)
  194. remove_entity_name("cs_chainsaw")
  195. }
  196.  
  197. public event_CurWeapon(id)
  198. {
  199. // Not alive...
  200. if(!is_user_alive(id))
  201. return PLUGIN_CONTINUE
  202.  
  203. // Updating weapon array
  204. g_iCurrentWeapon[id] = read_data(2)
  205.  
  206. // Check
  207. if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
  208. return PLUGIN_CONTINUE
  209.  
  210. // Has chainsaw and weapon is Knife
  211. if(!g_iHasChainsaw[id] || g_iCurrentWeapon[id] != CSW_KNIFE)
  212. return PLUGIN_CONTINUE
  213.  
  214. entity_set_string(id, EV_SZ_viewmodel, chainsaw_viewmodel)
  215. entity_set_string(id, EV_SZ_weaponmodel, chainsaw_playermodel)
  216.  
  217. return PLUGIN_CONTINUE
  218. }
  219.  
  220. /*================================================================================
  221.  [Main Functions]
  222. =================================================================================*/
  223.  
  224. public clcmd_drop(id)
  225. {
  226. // Has Chainsaw Weapon is Knife
  227. if(g_iHasChainsaw[id] && g_iCurrentWeapon[id] == CSW_KNIFE)
  228. {
  229. if(check_drop_flag(DROPFLAG_NORMAL))
  230. {
  231. drop_chainsaw(id)
  232. return PLUGIN_HANDLED
  233. }
  234. }
  235.  
  236. return PLUGIN_CONTINUE
  237. }
  238.  
  239. public drop_chainsaw(id)
  240. {
  241. // Get Aim and Origin
  242. static Float:flAim[3], Float:flOrigin[3]
  243. VelocityByAim(id, 64, flAim)
  244. entity_get_vector(id, EV_VEC_origin, flOrigin)
  245.  
  246. // Changing Origin coords
  247. flOrigin[0] += flAim[0]
  248. flOrigin[1] += flAim[1]
  249.  
  250. // Creating the Entity
  251. new iEnt = create_entity("info_target")
  252.  
  253. // Classname
  254. entity_set_string(iEnt, EV_SZ_classname, "cs_chainsaw")
  255.  
  256. // Origin
  257. entity_set_origin(iEnt, flOrigin)
  258.  
  259. // Models
  260. entity_set_model(iEnt, chainsaw_worldmodel)
  261.  
  262. // Size
  263. set_size(iEnt, chainsaw_mins, chainsaw_maxs)
  264. entity_set_vector(iEnt, EV_VEC_mins, chainsaw_mins)
  265. entity_set_vector(iEnt, EV_VEC_maxs, chainsaw_maxs)
  266.  
  267. // Solid Type
  268. entity_set_int(iEnt, EV_INT_solid, SOLID_TRIGGER)
  269.  
  270. // Movetype
  271. entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_TOSS)
  272.  
  273. // Var's
  274. g_iHasChainsaw[id] = false
  275.  
  276. // Model bugfix
  277. reset_user_knife(id)
  278. }
  279.  
  280. public reset_user_knife(id)
  281. {
  282. // Execute weapon Deploy
  283. if(user_has_weapon(id, CSW_KNIFE))
  284. ExecuteHamB(Ham_Item_Deploy, find_ent_by_owner(-1, "weapon_knife", id))
  285.  
  286. // Updating Model
  287. engclient_cmd(id, "weapon_knife")
  288. emessage_begin(MSG_ONE, g_msgCurWeapon, _, id)
  289. ewrite_byte(1) // active
  290. ewrite_byte(CSW_KNIFE) // weapon
  291. ewrite_byte(-1) // clip
  292. emessage_end()
  293. }
  294.  
  295. /*================================================================================
  296.  [ZombiePlague Forwards]
  297. =================================================================================*/
  298.  
  299. public zv_extra_item_selected(id, itemid)
  300. {
  301. if (itemid == g_iItemID)
  302. {
  303. // Check cvar
  304. if(get_pcvar_num(cvar_enable))
  305. {
  306. // Already has a Chainsaw
  307. if (g_iHasChainsaw[id])
  308. {
  309. zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + chainsaw_ap_cost)
  310. client_printcolor(id, "/g[ZP]/y You already have a /gChainsaw")
  311. }
  312. else
  313. {
  314. // Boolean
  315. g_iHasChainsaw[id] = true
  316.  
  317. // Emiting Sound
  318. emit_sound(id, CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  319.  
  320. // Client Print
  321. client_printcolor(id, "/g[ZP]/y You now have a /gChainsaw")
  322.  
  323. // Change weapon to Knife
  324. reset_user_knife(id)
  325. }
  326. }
  327. // Isn't enabled...
  328. else
  329. {
  330. zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + chainsaw_ap_cost)
  331. client_printcolor(id, "/g[ZP]/y Chainsaw item has been disabled. /gContact Admin")
  332. }
  333. }
  334. }
  335.  
  336. public zp_user_infected_pre(id, infector)
  337. {
  338. // Drop in infection
  339. if (g_iHasChainsaw[id])
  340. {
  341. if(check_drop_flag(DROPFLAG_INFECTED))
  342. drop_chainsaw(id)
  343. else
  344. {
  345. g_iHasChainsaw[id] = false
  346. reset_user_knife(id)
  347. }
  348. }
  349. }
  350.  
  351. public zp_user_humanized_post(id)
  352. {
  353. // Is survivor
  354. if(zp_get_user_survivor(id) && g_iHasChainsaw[id])
  355. {
  356. if(check_drop_flag(DROPFLAG_SURVHUMAN))
  357. drop_chainsaw(id)
  358. else
  359. {
  360. g_iHasChainsaw[id] = false
  361. reset_user_knife(id)
  362. }
  363. }
  364. }
  365.  
  366. /*================================================================================
  367.  [Main Forwards]
  368. =================================================================================*/
  369.  
  370. public client_putinserver(id)
  371. {
  372. g_iHasChainsaw[id] = false
  373. }
  374.  
  375. public client_disconnect(id)
  376. {
  377. g_iHasChainsaw[id] = false
  378. }
  379.  
  380. public fw_PlayerSpawn_Post(id)
  381. {
  382. // Check Oneround Cvar and Strip all the Chainsaws
  383. if(get_pcvar_num(cvar_oneround) || !get_pcvar_num(cvar_enable))
  384. {
  385. // Has Chainsaw
  386. if(g_iHasChainsaw[id])
  387. {
  388. // Var's
  389. g_iHasChainsaw[id] = false
  390.  
  391. // Update Knife
  392. reset_user_knife(id)
  393. }
  394. }
  395. }
  396.  
  397. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
  398. {
  399. // Check
  400. if(victim == attacker || !attacker)
  401. return HAM_IGNORED
  402.  
  403. // Attacker is not a Player
  404. if(!is_user_connected(attacker))
  405. return HAM_IGNORED
  406.  
  407. // Has chainsaw and Weapon is knife
  408. if(g_iHasChainsaw[attacker] && g_iCurrentWeapon[attacker] == CSW_KNIFE)
  409. {
  410. // Gore
  411. if(get_pcvar_num(cvar_dmggore))
  412. a_lot_of_blood(victim)
  413.  
  414. // Damage mult.
  415. SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmgmult))
  416.  
  417. }
  418.  
  419. return HAM_IGNORED
  420. }
  421.  
  422. public fw_PlayerKilled(victim, attacker, shouldgib)
  423. {
  424. // Check
  425. if(victim == attacker || !attacker)
  426. return HAM_IGNORED
  427.  
  428. // Attacker is not a Player
  429. if(!is_user_connected(attacker))
  430. return HAM_IGNORED
  431.  
  432. // Attacker Has a Chainsaw
  433. if(g_iHasChainsaw[attacker] && g_iCurrentWeapon[attacker] == CSW_KNIFE && !zp_get_user_nemesis(victim) && get_pcvar_num(cvar_body_xplode))
  434. SetHamParamInteger(3, 2) // Body Explodes
  435.  
  436. // Victim Has a Chainsaw
  437. if(g_iHasChainsaw[victim])
  438. {
  439. if(check_drop_flag(DROPFLAG_INDEATH))
  440. drop_chainsaw(victim)
  441. else
  442. {
  443. g_iHasChainsaw[victim] = false
  444. reset_user_knife(victim)
  445. }
  446. }
  447.  
  448. return HAM_IGNORED
  449. }
  450.  
  451. public fw_Chainsaw_Touch(saw, player)
  452. {
  453. // Entities are not valid
  454. if(!is_valid_ent(saw) || !is_valid_ent(player))
  455. return PLUGIN_CONTINUE
  456.  
  457. // Is a valid player?
  458. if(!is_user_connected(player))
  459. return PLUGIN_CONTINUE
  460.  
  461. // Alive, Zombie or Survivor
  462. if(!is_user_alive(player) || zp_get_user_zombie(player) || zp_get_user_survivor(player) || g_iHasChainsaw[player])
  463. return PLUGIN_CONTINUE
  464.  
  465. // Var's
  466. g_iHasChainsaw[player] = true
  467.  
  468. // Emiting Sound
  469. emit_sound(player, CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  470.  
  471. // Knife Deploy
  472. reset_user_knife(player)
  473.  
  474. // Remove dropped chainsaw
  475. remove_entity(saw)
  476.  
  477. return PLUGIN_CONTINUE
  478. }
  479.  
  480. public fw_EmitSound(id, channel, const sound[])
  481. {
  482. // Non-player entity
  483. if(!is_user_connected(id))
  484. return FMRES_IGNORED
  485.  
  486. // Not Alive / Zombie / Doesn't have a Chainsaw
  487. if(!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id) || !g_iHasChainsaw[id] || !get_pcvar_num(cvar_sounds))
  488. return FMRES_IGNORED
  489.  
  490. // Check sound
  491. for(new i = 0; i < sizeof chainsaw_sounds; i++)
  492. {
  493. if(equal(sound, oldknife_sounds[i]))
  494. {
  495. // Emit New sound and Stop old Sound
  496. emit_sound(id, channel, chainsaw_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  497. return FMRES_SUPERCEDE
  498. }
  499. }
  500.  
  501. return FMRES_IGNORED
  502. }
  503.  
  504. public fw_Knife_PrimaryAttack_Post(knife)
  505. {
  506. // Get knife owner
  507. static id
  508. id = get_pdata_cbase(knife, m_pPlayer, 4)
  509.  
  510. // has a Chainsaw
  511. if(is_user_connected(id) && g_iHasChainsaw[id])
  512. {
  513. // Get new fire rate
  514. static Float:flRate
  515. flRate = get_pcvar_float(cvar_pattack_rate)
  516.  
  517. // Set new rates
  518. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  519. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  520. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  521.  
  522. // Get new recoil
  523. static Float:flPunchAngle[3]
  524. flPunchAngle[0] = get_pcvar_float(cvar_pattack_recoil)
  525.  
  526. // Punch their angles
  527. entity_set_vector(id, EV_VEC_punchangle, flPunchAngle)
  528.  
  529. }
  530.  
  531. return HAM_IGNORED
  532. }
  533.  
  534. public fw_Knife_SecondaryAttack_Post(knife)
  535. {
  536. // Get knife owner
  537. static id
  538. id = get_pdata_cbase(knife, m_pPlayer, 4)
  539.  
  540. // has a Chainsaw
  541. if(is_user_connected(id) && g_iHasChainsaw[id])
  542. {
  543. // Get new fire rate
  544. static Float:flRate
  545. flRate = get_pcvar_float(cvar_sattack_rate)
  546.  
  547. // Set new rates
  548. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  549. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  550. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  551.  
  552. // Get new recoil
  553. static Float:flPunchAngle[3]
  554. flPunchAngle[0] = get_pcvar_float(cvar_sattack_recoil)
  555.  
  556. // Punch their angles
  557. entity_set_vector(id, EV_VEC_punchangle, flPunchAngle)
  558. }
  559.  
  560. return HAM_IGNORED
  561. }
  562.  
  563. /*================================================================================
  564.  [Internal Functions]
  565. =================================================================================*/
  566.  
  567. check_drop_flag(flag)
  568. {
  569. new szFlags[10]
  570. get_pcvar_string(cvar_dropflags, szFlags, charsmax(szFlags))
  571.  
  572. if(read_flags(szFlags) & flag)
  573. return true
  574.  
  575. return false
  576. }
  577.  
  578. a_lot_of_blood(id) // ROFL, thanks to jtp10181 for his AMX Ultimate Gore plugin.
  579. {
  580. // Get user origin
  581. static iOrigin[3]
  582. get_user_origin(id, iOrigin)
  583.  
  584. // Blood spray
  585. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
  586. write_byte(TE_BLOODSTREAM)
  587. write_coord(iOrigin[0])
  588. write_coord(iOrigin[1])
  589. write_coord(iOrigin[2]+10)
  590. write_coord(random_num(-360, 360)) // x
  591. write_coord(random_num(-360, 360)) // y
  592. write_coord(-10) // z
  593. write_byte(70) // color
  594. write_byte(random_num(50, 100)) // speed
  595. message_end()
  596.  
  597. // Write Small splash decal
  598. for (new j = 0; j < 4; j++)
  599. {
  600. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
  601. write_byte(TE_WORLDDECAL)
  602. write_coord(iOrigin[0]+random_num(-100, 100))
  603. write_coord(iOrigin[1]+random_num(-100, 100))
  604. write_coord(iOrigin[2]-36)
  605. write_byte(random_num(190, 197)) // index
  606. message_end()
  607. }
  608. }
  609.  
  610. /*================================================================================
  611.  [Stocks]
  612. =================================================================================*/
  613.  
  614. stock client_printcolor(const id, const input[], any:...)
  615. {
  616. new iCount = 1, iPlayers[32]
  617.  
  618. static szMsg[191]
  619. vformat(szMsg, charsmax(szMsg), input, 3)
  620.  
  621. replace_all(szMsg, 190, "/g", "^4") // green txt
  622. replace_all(szMsg, 190, "/y", "^1") // orange txt
  623. replace_all(szMsg, 190, "/ctr", "^3") // team txt
  624. replace_all(szMsg, 190, "/w", "^0") // team txt
  625.  
  626. if(id) iPlayers[0] = id
  627. else get_players(iPlayers, iCount, "ch")
  628.  
  629. for (new i = 0; i < iCount; i++)
  630. {
  631. if (is_user_connected(iPlayers[i]))
  632. {
  633. message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayers[i])
  634. write_byte(iPlayers[i])
  635. write_string(szMsg)
  636. message_end()
  637. }
  638. }
  639. }
  640.  
dontercfg írta:
SMA-t linkeld!

Ők köszönték meg brutal nek ezt a hozzászólást: rrobert89 (2013.03.16. 22:11)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Extra cuccok
HozzászólásElküldve: 2013.02.24. 15:06 
Offline
Lelkes

Csatlakozott: 2013.02.05. 15:30
Hozzászólások: 19
Megköszönt másnak: 6 alkalommal
Megköszönték neki: 1 alkalommal
brutal írta:
SMA Forráskód: [ Mindet kijelol ]
  1. /*================================================================================
  2.  
  3. [ZP] Extra Item: Chainsaw
  4. Copyright (C) 2009 by meTaLiCroSS, Vińa del Mar, Chile
  5.  
  6. This program is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program. If not, see <http://www.gnu.org/licenses/>.
  18.  
  19. In addition, as a special exception, the author gives permission to
  20. link the code of this program with the Half-Life Game Engine ("HL
  21. Engine") and Modified Game Libraries ("MODs") developed by Valve,
  22. L.L.C ("Valve"). You must obey the GNU General Public License in all
  23. respects for all of the code used other than the HL Engine and MODs
  24. from Valve. If you modify this file, you may extend this exception
  25. to your version of the file, but you are not obligated to do so. If
  26. you do not wish to do so, delete this exception statement from your
  27. version.
  28.  
  29. ** Credits:
  30.  
  31. - B!gBud: Some code of his Jetpack + Bazooka
  32. - jtp10181: For his AMX Ultimate Gore plugin and good blood effects
  33.  
  34. =================================================================================*/
  35.  
  36. #include <amxmodx>
  37. #include <fakemeta>
  38. #include <engine>
  39. #include <hamsandwich>
  40. #include <zombieplague>
  41. #include <zmvip>
  42.  
  43. /*================================================================================
  44.  [Customization]
  45. =================================================================================*/
  46.  
  47. // Item Cost
  48. const chainsaw_ap_cost = 40 // Ammo packs Cost
  49.  
  50. // Custom Chainsaw Models
  51. new const chainsaw_viewmodel[] = "models/chainsaw/v_chainsaw.mdl" // View Weapon Model (v_)
  52. new const chainsaw_playermodel[] = "models/chainsaw/p_chainsaw.mdl" // Player Weapon Model (p_)
  53. new const chainsaw_worldmodel[] = "models/chainsaw/w_chainsaw.mdl" // World Weapon Model (w_)
  54.  
  55. // Custom Chainsaw Sounds
  56. new const chainsaw_sounds[][] =
  57. {
  58. "chainsaw/chainsaw_deploy.wav", // Deploy Sound (knife_deploy1.wav)
  59. "chainsaw/chainsaw_hit1.wav", // Hit 1 (knife_hit1.wav)
  60. "chainsaw/chainsaw_hit2.wav", // Hit 2 (knife_hit2.wav)
  61. "chainsaw/chainsaw_hit1.wav", // Hit 3 (knife_hit3.wav)
  62. "chainsaw/chainsaw_hit2.wav", // Hit 4 (knife_hit4.wav)
  63. "chainsaw/chainsaw_hitwall.wav", // Hit Wall (knife_hitwall1.wav)
  64. "chainsaw/chainsaw_miss.wav", // Slash 1 (knife_slash1.wav)
  65. "chainsaw/chainsaw_miss.wav", // Slash 2 (knife_slash2.wav)
  66. "chainsaw/chainsaw_stab.wav" // Stab (knife_stab1.wav)
  67. }
  68.  
  69. // Dropped Chainsaw Size
  70. new Float:chainsaw_mins[3] = { -2.0, -2.0, -2.0 }
  71. new Float:chainsaw_maxs[3] = { 2.0, 2.0, 2.0 }
  72.  
  73.  
  74. /*================================================================================
  75.  Customization ends here! Yes, that's it. Editing anything beyond
  76.  here is not officially supported. Proceed at your own risk...
  77. =================================================================================*/
  78.  
  79. // Variables
  80. new g_iItemID, g_msgCurWeapon, g_msgSayText
  81.  
  82. // Arrays
  83. new g_iHasChainsaw[33], g_iCurrentWeapon[33]
  84.  
  85. // Cvar Pointers
  86. new cvar_enable, cvar_dmgmult, cvar_oneround, cvar_sounds, cvar_dmggore, cvar_dropflags,
  87. cvar_pattack_rate, cvar_sattack_rate, cvar_pattack_recoil, cvar_sattack_recoil, cvar_body_xplode
  88.  
  89. // Flags
  90. const DROPFLAG_NORMAL = (1<<0) // "a", with "drop" clcmd (pressing G by default)
  91. const DROPFLAG_INDEATH = (1<<1) // "b", death victim
  92. const DROPFLAG_INFECTED = (1<<2) // "c", user infected
  93. const DROPFLAG_SURVHUMAN = (1<<3) // "d", user become survivor
  94.  
  95. // Offsets
  96. const m_pPlayer = 41
  97. const m_flNextPrimaryAttack = 46
  98. const m_flNextSecondaryAttack = 47
  99. const m_flTimeWeaponIdle = 48
  100.  
  101. // Old Knife Sounds (DON'T CHANGE)
  102. new const oldknife_sounds[][] =
  103. {
  104. "weapons/knife_deploy1.wav", // Deploy Sound
  105. "weapons/knife_hit1.wav", // Hit 1
  106. "weapons/knife_hit2.wav", // Hit 2
  107. "weapons/knife_hit3.wav", // Hit 3
  108. "weapons/knife_hit4.wav", // Hit 4
  109. "weapons/knife_hitwall1.wav", // Hit Wall
  110. "weapons/knife_slash1.wav", // Slash 1
  111. "weapons/knife_slash2.wav", // Slash 2
  112. "weapons/knife_stab.wav" // Stab
  113. }
  114.  
  115. // Plug info.
  116. #define PLUG_VERSION "0.9"
  117. #define PLUG_AUTH "meTaLiCroSS"
  118.  
  119. /*================================================================================
  120.  [Init and Precache]
  121. =================================================================================*/
  122.  
  123. public plugin_init()
  124. {
  125. // Plugin Register
  126. register_plugin("[ZP] Extra Item: Chainsaw", PLUG_VERSION, PLUG_AUTH)
  127.  
  128. // Events
  129. register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0")
  130. register_event("CurWeapon", "event_CurWeapon", "b", "1=1")
  131.  
  132. // Cvars
  133. cvar_enable = register_cvar("zp_chainsaw_enable", "1")
  134. cvar_sounds = register_cvar("zp_chainsaw_custom_sounds", "1")
  135. cvar_dmgmult = register_cvar("zp_chainsaw_damage_mult", "8.4")
  136. cvar_dmggore = register_cvar("zp_chainsaw_gore_in_damage", "1")
  137. cvar_oneround = register_cvar("zp_chainsaw_oneround", "0")
  138. cvar_dropflags = register_cvar("zp_chainsaw_drop_flags", "abcd")
  139. cvar_body_xplode = register_cvar("zp_chainsaw_victim_explode", "1")
  140. cvar_pattack_rate = register_cvar("zp_chainsaw_attack1_rate", "0.6")
  141. cvar_sattack_rate = register_cvar("zp_chainsaw_attack2_rate", "1.2")
  142. cvar_pattack_recoil = register_cvar("zp_chainsaw_attack1_recoil", "-5.6")
  143. cvar_sattack_recoil = register_cvar("zp_chainsaw_attack2_recoil", "-8.0")
  144.  
  145. new szCvar[30]
  146. formatex(szCvar, charsmax(szCvar), "v%s by %s", PLUG_VERSION, PLUG_AUTH)
  147. register_cvar("zp_extra_chainsaw", szCvar, FCVAR_SERVER|FCVAR_SPONLY)
  148.  
  149. // Fakemeta Forwards
  150. register_forward(FM_EmitSound, "fw_EmitSound")
  151.  
  152. // Engine Forwards
  153. register_touch("cs_chainsaw", "player", "fw_Chainsaw_Touch")
  154.  
  155. // Ham Forwards
  156. RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
  157. RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  158. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  159. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fw_Knife_PrimaryAttack_Post", 1)
  160. RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fw_Knife_SecondaryAttack_Post", 1)
  161.  
  162. // Variables
  163. g_iItemID = zv_register_extra_item("Lancfuresz", "Chansaw for cutting zombies", chainsaw_ap_cost, ZV_TEAM_HUMAN)
  164.  
  165. // Message ID's vars
  166. g_msgSayText = get_user_msgid("SayText")
  167. g_msgCurWeapon = get_user_msgid("CurWeapon")
  168.  
  169. // Client Commands
  170. register_clcmd("drop", "clcmd_drop")
  171. }
  172.  
  173. public plugin_precache()
  174. {
  175. // Models
  176. precache_model(chainsaw_viewmodel)
  177. precache_model(chainsaw_playermodel)
  178. precache_model(chainsaw_worldmodel)
  179.  
  180. // Sounds
  181. for(new i = 0; i < sizeof chainsaw_sounds; i++)
  182. precache_sound(chainsaw_sounds[i])
  183.  
  184. precache_sound("items/gunpickup2.wav")
  185. }
  186.  
  187. /*================================================================================
  188.  [Main Events]
  189. =================================================================================*/
  190.  
  191. public event_RoundStart()
  192. {
  193. // Remove chainsaws (entities)
  194. remove_entity_name("cs_chainsaw")
  195. }
  196.  
  197. public event_CurWeapon(id)
  198. {
  199. // Not alive...
  200. if(!is_user_alive(id))
  201. return PLUGIN_CONTINUE
  202.  
  203. // Updating weapon array
  204. g_iCurrentWeapon[id] = read_data(2)
  205.  
  206. // Check
  207. if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
  208. return PLUGIN_CONTINUE
  209.  
  210. // Has chainsaw and weapon is Knife
  211. if(!g_iHasChainsaw[id] || g_iCurrentWeapon[id] != CSW_KNIFE)
  212. return PLUGIN_CONTINUE
  213.  
  214. entity_set_string(id, EV_SZ_viewmodel, chainsaw_viewmodel)
  215. entity_set_string(id, EV_SZ_weaponmodel, chainsaw_playermodel)
  216.  
  217. return PLUGIN_CONTINUE
  218. }
  219.  
  220. /*================================================================================
  221.  [Main Functions]
  222. =================================================================================*/
  223.  
  224. public clcmd_drop(id)
  225. {
  226. // Has Chainsaw Weapon is Knife
  227. if(g_iHasChainsaw[id] && g_iCurrentWeapon[id] == CSW_KNIFE)
  228. {
  229. if(check_drop_flag(DROPFLAG_NORMAL))
  230. {
  231. drop_chainsaw(id)
  232. return PLUGIN_HANDLED
  233. }
  234. }
  235.  
  236. return PLUGIN_CONTINUE
  237. }
  238.  
  239. public drop_chainsaw(id)
  240. {
  241. // Get Aim and Origin
  242. static Float:flAim[3], Float:flOrigin[3]
  243. VelocityByAim(id, 64, flAim)
  244. entity_get_vector(id, EV_VEC_origin, flOrigin)
  245.  
  246. // Changing Origin coords
  247. flOrigin[0] += flAim[0]
  248. flOrigin[1] += flAim[1]
  249.  
  250. // Creating the Entity
  251. new iEnt = create_entity("info_target")
  252.  
  253. // Classname
  254. entity_set_string(iEnt, EV_SZ_classname, "cs_chainsaw")
  255.  
  256. // Origin
  257. entity_set_origin(iEnt, flOrigin)
  258.  
  259. // Models
  260. entity_set_model(iEnt, chainsaw_worldmodel)
  261.  
  262. // Size
  263. set_size(iEnt, chainsaw_mins, chainsaw_maxs)
  264. entity_set_vector(iEnt, EV_VEC_mins, chainsaw_mins)
  265. entity_set_vector(iEnt, EV_VEC_maxs, chainsaw_maxs)
  266.  
  267. // Solid Type
  268. entity_set_int(iEnt, EV_INT_solid, SOLID_TRIGGER)
  269.  
  270. // Movetype
  271. entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_TOSS)
  272.  
  273. // Var's
  274. g_iHasChainsaw[id] = false
  275.  
  276. // Model bugfix
  277. reset_user_knife(id)
  278. }
  279.  
  280. public reset_user_knife(id)
  281. {
  282. // Execute weapon Deploy
  283. if(user_has_weapon(id, CSW_KNIFE))
  284. ExecuteHamB(Ham_Item_Deploy, find_ent_by_owner(-1, "weapon_knife", id))
  285.  
  286. // Updating Model
  287. engclient_cmd(id, "weapon_knife")
  288. emessage_begin(MSG_ONE, g_msgCurWeapon, _, id)
  289. ewrite_byte(1) // active
  290. ewrite_byte(CSW_KNIFE) // weapon
  291. ewrite_byte(-1) // clip
  292. emessage_end()
  293. }
  294.  
  295. /*================================================================================
  296.  [ZombiePlague Forwards]
  297. =================================================================================*/
  298.  
  299. public zv_extra_item_selected(id, itemid)
  300. {
  301. if (itemid == g_iItemID)
  302. {
  303. // Check cvar
  304. if(get_pcvar_num(cvar_enable))
  305. {
  306. // Already has a Chainsaw
  307. if (g_iHasChainsaw[id])
  308. {
  309. zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + chainsaw_ap_cost)
  310. client_printcolor(id, "/g[ZP]/y You already have a /gChainsaw")
  311. }
  312. else
  313. {
  314. // Boolean
  315. g_iHasChainsaw[id] = true
  316.  
  317. // Emiting Sound
  318. emit_sound(id, CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  319.  
  320. // Client Print
  321. client_printcolor(id, "/g[ZP]/y You now have a /gChainsaw")
  322.  
  323. // Change weapon to Knife
  324. reset_user_knife(id)
  325. }
  326. }
  327. // Isn't enabled...
  328. else
  329. {
  330. zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + chainsaw_ap_cost)
  331. client_printcolor(id, "/g[ZP]/y Chainsaw item has been disabled. /gContact Admin")
  332. }
  333. }
  334. }
  335.  
  336. public zp_user_infected_pre(id, infector)
  337. {
  338. // Drop in infection
  339. if (g_iHasChainsaw[id])
  340. {
  341. if(check_drop_flag(DROPFLAG_INFECTED))
  342. drop_chainsaw(id)
  343. else
  344. {
  345. g_iHasChainsaw[id] = false
  346. reset_user_knife(id)
  347. }
  348. }
  349. }
  350.  
  351. public zp_user_humanized_post(id)
  352. {
  353. // Is survivor
  354. if(zp_get_user_survivor(id) && g_iHasChainsaw[id])
  355. {
  356. if(check_drop_flag(DROPFLAG_SURVHUMAN))
  357. drop_chainsaw(id)
  358. else
  359. {
  360. g_iHasChainsaw[id] = false
  361. reset_user_knife(id)
  362. }
  363. }
  364. }
  365.  
  366. /*================================================================================
  367.  [Main Forwards]
  368. =================================================================================*/
  369.  
  370. public client_putinserver(id)
  371. {
  372. g_iHasChainsaw[id] = false
  373. }
  374.  
  375. public client_disconnect(id)
  376. {
  377. g_iHasChainsaw[id] = false
  378. }
  379.  
  380. public fw_PlayerSpawn_Post(id)
  381. {
  382. // Check Oneround Cvar and Strip all the Chainsaws
  383. if(get_pcvar_num(cvar_oneround) || !get_pcvar_num(cvar_enable))
  384. {
  385. // Has Chainsaw
  386. if(g_iHasChainsaw[id])
  387. {
  388. // Var's
  389. g_iHasChainsaw[id] = false
  390.  
  391. // Update Knife
  392. reset_user_knife(id)
  393. }
  394. }
  395. }
  396.  
  397. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
  398. {
  399. // Check
  400. if(victim == attacker || !attacker)
  401. return HAM_IGNORED
  402.  
  403. // Attacker is not a Player
  404. if(!is_user_connected(attacker))
  405. return HAM_IGNORED
  406.  
  407. // Has chainsaw and Weapon is knife
  408. if(g_iHasChainsaw[attacker] && g_iCurrentWeapon[attacker] == CSW_KNIFE)
  409. {
  410. // Gore
  411. if(get_pcvar_num(cvar_dmggore))
  412. a_lot_of_blood(victim)
  413.  
  414. // Damage mult.
  415. SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmgmult))
  416.  
  417. }
  418.  
  419. return HAM_IGNORED
  420. }
  421.  
  422. public fw_PlayerKilled(victim, attacker, shouldgib)
  423. {
  424. // Check
  425. if(victim == attacker || !attacker)
  426. return HAM_IGNORED
  427.  
  428. // Attacker is not a Player
  429. if(!is_user_connected(attacker))
  430. return HAM_IGNORED
  431.  
  432. // Attacker Has a Chainsaw
  433. if(g_iHasChainsaw[attacker] && g_iCurrentWeapon[attacker] == CSW_KNIFE && !zp_get_user_nemesis(victim) && get_pcvar_num(cvar_body_xplode))
  434. SetHamParamInteger(3, 2) // Body Explodes
  435.  
  436. // Victim Has a Chainsaw
  437. if(g_iHasChainsaw[victim])
  438. {
  439. if(check_drop_flag(DROPFLAG_INDEATH))
  440. drop_chainsaw(victim)
  441. else
  442. {
  443. g_iHasChainsaw[victim] = false
  444. reset_user_knife(victim)
  445. }
  446. }
  447.  
  448. return HAM_IGNORED
  449. }
  450.  
  451. public fw_Chainsaw_Touch(saw, player)
  452. {
  453. // Entities are not valid
  454. if(!is_valid_ent(saw) || !is_valid_ent(player))
  455. return PLUGIN_CONTINUE
  456.  
  457. // Is a valid player?
  458. if(!is_user_connected(player))
  459. return PLUGIN_CONTINUE
  460.  
  461. // Alive, Zombie or Survivor
  462. if(!is_user_alive(player) || zp_get_user_zombie(player) || zp_get_user_survivor(player) || g_iHasChainsaw[player])
  463. return PLUGIN_CONTINUE
  464.  
  465. // Var's
  466. g_iHasChainsaw[player] = true
  467.  
  468. // Emiting Sound
  469. emit_sound(player, CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  470.  
  471. // Knife Deploy
  472. reset_user_knife(player)
  473.  
  474. // Remove dropped chainsaw
  475. remove_entity(saw)
  476.  
  477. return PLUGIN_CONTINUE
  478. }
  479.  
  480. public fw_EmitSound(id, channel, const sound[])
  481. {
  482. // Non-player entity
  483. if(!is_user_connected(id))
  484. return FMRES_IGNORED
  485.  
  486. // Not Alive / Zombie / Doesn't have a Chainsaw
  487. if(!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_survivor(id) || !g_iHasChainsaw[id] || !get_pcvar_num(cvar_sounds))
  488. return FMRES_IGNORED
  489.  
  490. // Check sound
  491. for(new i = 0; i < sizeof chainsaw_sounds; i++)
  492. {
  493. if(equal(sound, oldknife_sounds[i]))
  494. {
  495. // Emit New sound and Stop old Sound
  496. emit_sound(id, channel, chainsaw_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  497. return FMRES_SUPERCEDE
  498. }
  499. }
  500.  
  501. return FMRES_IGNORED
  502. }
  503.  
  504. public fw_Knife_PrimaryAttack_Post(knife)
  505. {
  506. // Get knife owner
  507. static id
  508. id = get_pdata_cbase(knife, m_pPlayer, 4)
  509.  
  510. // has a Chainsaw
  511. if(is_user_connected(id) && g_iHasChainsaw[id])
  512. {
  513. // Get new fire rate
  514. static Float:flRate
  515. flRate = get_pcvar_float(cvar_pattack_rate)
  516.  
  517. // Set new rates
  518. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  519. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  520. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  521.  
  522. // Get new recoil
  523. static Float:flPunchAngle[3]
  524. flPunchAngle[0] = get_pcvar_float(cvar_pattack_recoil)
  525.  
  526. // Punch their angles
  527. entity_set_vector(id, EV_VEC_punchangle, flPunchAngle)
  528.  
  529. }
  530.  
  531. return HAM_IGNORED
  532. }
  533.  
  534. public fw_Knife_SecondaryAttack_Post(knife)
  535. {
  536. // Get knife owner
  537. static id
  538. id = get_pdata_cbase(knife, m_pPlayer, 4)
  539.  
  540. // has a Chainsaw
  541. if(is_user_connected(id) && g_iHasChainsaw[id])
  542. {
  543. // Get new fire rate
  544. static Float:flRate
  545. flRate = get_pcvar_float(cvar_sattack_rate)
  546.  
  547. // Set new rates
  548. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  549. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  550. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  551.  
  552. // Get new recoil
  553. static Float:flPunchAngle[3]
  554. flPunchAngle[0] = get_pcvar_float(cvar_sattack_recoil)
  555.  
  556. // Punch their angles
  557. entity_set_vector(id, EV_VEC_punchangle, flPunchAngle)
  558. }
  559.  
  560. return HAM_IGNORED
  561. }
  562.  
  563. /*================================================================================
  564.  [Internal Functions]
  565. =================================================================================*/
  566.  
  567. check_drop_flag(flag)
  568. {
  569. new szFlags[10]
  570. get_pcvar_string(cvar_dropflags, szFlags, charsmax(szFlags))
  571.  
  572. if(read_flags(szFlags) & flag)
  573. return true
  574.  
  575. return false
  576. }
  577.  
  578. a_lot_of_blood(id) // ROFL, thanks to jtp10181 for his AMX Ultimate Gore plugin.
  579. {
  580. // Get user origin
  581. static iOrigin[3]
  582. get_user_origin(id, iOrigin)
  583.  
  584. // Blood spray
  585. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
  586. write_byte(TE_BLOODSTREAM)
  587. write_coord(iOrigin[0])
  588. write_coord(iOrigin[1])
  589. write_coord(iOrigin[2]+10)
  590. write_coord(random_num(-360, 360)) // x
  591. write_coord(random_num(-360, 360)) // y
  592. write_coord(-10) // z
  593. write_byte(70) // color
  594. write_byte(random_num(50, 100)) // speed
  595. message_end()
  596.  
  597. // Write Small splash decal
  598. for (new j = 0; j < 4; j++)
  599. {
  600. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
  601. write_byte(TE_WORLDDECAL)
  602. write_coord(iOrigin[0]+random_num(-100, 100))
  603. write_coord(iOrigin[1]+random_num(-100, 100))
  604. write_coord(iOrigin[2]-36)
  605. write_byte(random_num(190, 197)) // index
  606. message_end()
  607. }
  608. }
  609.  
  610. /*================================================================================
  611.  [Stocks]
  612. =================================================================================*/
  613.  
  614. stock client_printcolor(const id, const input[], any:...)
  615. {
  616. new iCount = 1, iPlayers[32]
  617.  
  618. static szMsg[191]
  619. vformat(szMsg, charsmax(szMsg), input, 3)
  620.  
  621. replace_all(szMsg, 190, "/g", "^4") // green txt
  622. replace_all(szMsg, 190, "/y", "^1") // orange txt
  623. replace_all(szMsg, 190, "/ctr", "^3") // team txt
  624. replace_all(szMsg, 190, "/w", "^0") // team txt
  625.  
  626. if(id) iPlayers[0] = id
  627. else get_players(iPlayers, iCount, "ch")
  628.  
  629. for (new i = 0; i < iCount; i++)
  630. {
  631. if (is_user_connected(iPlayers[i]))
  632. {
  633. message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayers[i])
  634. write_byte(iPlayers[i])
  635. write_string(szMsg)
  636. message_end()
  637. }
  638. }
  639. }
  640.  
dontercfg írta:
SMA-t linkeld!



Erre gondoltál?


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 4 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 1 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole