Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.28 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <zombieplague>
  4. #include <fun>
  5. #include <cstrike>
  6. #include <engine>
  7. #include <hamsandwich>
  8. #include <fakemeta>
  9.  
  10. /* [ZP] Extra Item : Sniper Laser Gun [SLG] ! By xLeoNNN. (san antonio,chile)
  11. this is my second plugin, the Sniper Laser Gun [SLG] is a weapon awp with efects,laser,
  12. Credits :
  13.  
  14. meTaLiCroSS : for code of damage of "gauss"
  15. Mr.Death : how to create the effects and use the "Temp Entity"
  16. */
  17.  
  18. new g_ibuy
  19. new bullets[33]
  20. new hotflarex, laserb, thunder
  21. new bool:g_lasergun[33]
  22. new g_iMaxPlayers
  23. const q_pPlayer = 41
  24. new Shakes
  25. const Second = ( 1<<10 )
  26. new cvar_particles_dead, cvar_bullet_efect, cvar_thunder, cvar_oneround
  27. new g_currentweapon[33]
  28.  
  29. new V_LASERGUN[] = "models/zombie_plague/v_sniper_laser_gun.mdl"
  30. new P_LASERGUN[] = "models/zombie_plague/p_sniper_laser_gun.mdl"
  31. new W_LASERGUN[] = "models/zombie_plague/w_sniper_laser_gun.mdl"
  32. new const LaserSound[] = "weapons/electro4.wav"
  33.  
  34. public plugin_init()
  35. {
  36. register_plugin("[ZP] Extra Item: Sniper Laser Gun", "1.0", "x[L]eoNNN")
  37. g_ibuy = zp_register_extra_item("\y[GOLD] \rSniperLaserGun", 200, ZP_TEAM_HUMAN)
  38. Shakes = get_user_msgid( "ScreenShake" )
  39. register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
  40. register_event("CurWeapon", "Event_CurWeapon", "be","1=1")
  41. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  42. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  43. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "fw_AWP_PrimaryAttack_Post", 1)
  44. RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
  45. register_forward(FM_SetModel, "fw_SetModel")
  46. cvar_particles_dead = register_cvar("zp_slg_particles", "1")
  47. cvar_bullet_efect = register_cvar("zp_slg_bullet", "1")
  48. cvar_thunder = register_cvar("zp_slg_thunder", "1")
  49. cvar_oneround = register_cvar("zp_slg_oneround", "1")
  50.  
  51. }
  52.  
  53. public plugin_precache()
  54. {
  55. hotflarex = precache_model("sprites/flare6.spr")
  56. laserb = precache_model("sprites/laserbeam.spr")
  57. thunder = precache_model("sprites/zbeam1.spr")
  58. precache_model(V_LASERGUN)
  59. precache_model(P_LASERGUN)
  60. precache_model(W_LASERGUN)
  61. precache_sound(LaserSound)
  62. }
  63.  
  64. public zp_extra_item_selected(id, itemid)
  65. {
  66. if (itemid ==g_ibuy)
  67. {
  68. if(get_user_flags(id) & read_flags("p"))
  69. {
  70. g_lasergun[id] = true
  71. give_item (id, "weapon_awp")
  72. cs_set_user_bpammo(id, CSW_AWP, 20)
  73. client_print(id, print_center, "[ZP] Sniper Laser Gun ON! Killed All Zombies!")
  74. }
  75. else
  76. {
  77. return PLUGIN_HANDLED
  78. }
  79. }
  80.  
  81. if(g_lasergun[id] && user_has_weapon(id, CSW_AWP))
  82. {
  83. client_print(id, print_chat, "\g[GOLD]\y You Already Have Sniper Laser Gun!")
  84. zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 40)
  85. return PLUGIN_CONTINUE
  86. }
  87.  
  88. return PLUGIN_CONTINUE
  89. }
  90.  
  91. public zp_user_infected_post(infected, infector)
  92. {
  93. if (g_lasergun[infected])
  94. {
  95. g_lasergun[infected] = false
  96. }
  97. }
  98. public motd(id)
  99. {
  100. new configsdir[200]
  101. new MOTDfile[200]
  102.  
  103. get_configsdir(configsdir,199)
  104. format(MOTDfile,199,"%s/motd/gold.html",configsdir)
  105.  
  106. show_motd(id,MOTDfile)
  107.  
  108. return PLUGIN_HANDLED
  109. }
  110. public event_round_start()
  111. {
  112. for (new i = 1; i <= g_iMaxPlayers; i++)
  113. {
  114. if (!is_user_connected(i))
  115. continue
  116.  
  117. if (g_lasergun[i])
  118. {
  119. g_lasergun[i] = false
  120. }
  121. }
  122. }
  123.  
  124. public client_putinserver(id)
  125. {
  126. g_lasergun[id] = false
  127. }
  128.  
  129. public client_disconnect(id)
  130. {
  131. g_lasergun[id] = false
  132. }
  133.  
  134. public make_tracer(id)
  135. {
  136. if(get_pcvar_num(cvar_bullet_efect))
  137. {
  138. if(g_lasergun[id] && g_currentweapon[id])
  139. {
  140. new clip,ammo
  141. new wpnid = get_user_weapon(id,clip,ammo)
  142. new pteam[16]
  143.  
  144. get_user_team(id, pteam, 15)
  145.  
  146. if ((bullets[id] > clip) && (wpnid == CSW_AWP))
  147. {
  148. new laser1[3], laser2[3]
  149. get_user_origin(id, laser1, 1)
  150. get_user_origin(id, laser2, 4)
  151.  
  152. message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
  153. write_byte (1)
  154. write_short(id | 0x1000)
  155. write_coord (laser2[0])
  156. write_coord (laser2[1])
  157. write_coord (laser2[2])
  158. write_short( laserb )
  159. write_byte(1)
  160. write_byte(5)
  161. write_byte(1)
  162. write_byte(80)
  163. write_byte(20)
  164. write_byte(0)
  165. write_byte(52)
  166. write_byte(255)
  167. write_byte(255)
  168. write_byte(150)
  169. message_end()
  170.  
  171. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  172. write_byte(TE_DLIGHT)
  173. write_coord(laser1[0])
  174. write_coord(laser1[1])
  175. write_coord(laser1[2])
  176. write_byte(13)
  177. write_byte(254)
  178. write_byte(0)
  179. write_byte(0)
  180. write_byte(100)
  181. write_byte(10)
  182. message_end()
  183.  
  184. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  185. write_byte(TE_SPRITETRAIL)
  186. write_coord(laser1[0])
  187. write_coord(laser1[1])
  188. write_coord(laser1[2])
  189. write_coord(laser1[0])
  190. write_coord(laser1[1])
  191. write_coord(laser1[2])
  192. write_short(hotflarex)
  193. write_byte(5)
  194. write_byte(1)
  195. write_byte(3)
  196. write_byte(34)
  197. write_byte(43)
  198. message_end()
  199. emit_sound(id, CHAN_AUTO, LaserSound, VOL_NORM, ATTN_NORM , 0, PITCH_NORM)
  200.  
  201. }
  202. bullets[id] = clip
  203. }
  204. }
  205. }
  206.  
  207. public Event_CurWeapon(id)
  208. {
  209. g_currentweapon[id] = read_data(2)
  210.  
  211. if(!g_lasergun[id] || g_currentweapon[id] != CSW_AWP)
  212. return PLUGIN_CONTINUE
  213.  
  214. entity_set_string(id, EV_SZ_viewmodel, V_LASERGUN)
  215. entity_set_string(id, EV_SZ_weaponmodel, P_LASERGUN)
  216.  
  217. return PLUGIN_CONTINUE
  218. }
  219.  
  220. public fw_SetModel(entity, model[])
  221. {
  222. if(!is_valid_ent(entity))
  223. return FMRES_IGNORED
  224.  
  225.  
  226. if(!equali(model, "models/w_awp.mdl"))
  227. return FMRES_IGNORED;
  228.  
  229. new ads = entity_get_edict(entity, EV_ENT_owner)
  230. new className[33]
  231. entity_get_string(entity, EV_SZ_classname, className, 32)
  232.  
  233. if(equal(className, "weaponbox") || equal(className, "armoury_entity") || equal(className, "grenade"))
  234. {
  235. if(g_lasergun[ads])
  236. {
  237. entity_set_model(entity, W_LASERGUN)
  238. return FMRES_SUPERCEDE
  239. }
  240. }
  241.  
  242. return FMRES_IGNORED
  243. }
  244.  
  245. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
  246. {
  247. if(!is_user_connected(attacker) || !is_user_connected(victim) || zp_get_user_nemesis(victim) || attacker == victim || !attacker)
  248. return HAM_IGNORED
  249.  
  250. if (g_lasergun[attacker] && g_currentweapon[attacker] == CSW_AWP)
  251. {
  252. static Float:originF[3]
  253. pev(victim, pev_origin, originF)
  254.  
  255. new plrWeapId, plrClip, plrAmmo
  256. plrWeapId = get_user_weapon(attacker, plrClip, plrAmmo)
  257. if (plrWeapId == CSW_AWP)
  258. SetHamParamFloat(4, damage += get_user_health(victim))
  259.  
  260. client_print(attacker, print_center, "Enemy Electrocuted!")
  261. if(get_pcvar_num(cvar_particles_dead))
  262. dead_efect(originF)
  263. }
  264.  
  265. if(zp_get_user_nemesis(victim))
  266. {
  267. client_print(attacker, print_center, "Nemesis is Inmune")
  268. }
  269. return PLUGIN_HANDLED;
  270. }
  271.  
  272. dead_efect(const Float:originF[3])
  273. {
  274. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  275. write_byte(TE_PARTICLEBURST)
  276. engfunc(EngFunc_WriteCoord, originF[0])
  277. engfunc(EngFunc_WriteCoord, originF[1])
  278. engfunc(EngFunc_WriteCoord, originF[2]+10)
  279. write_short(250)
  280. write_byte(70)
  281. write_byte(55)
  282. message_end()
  283.  
  284. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  285. write_byte(TE_PARTICLEBURST)
  286. engfunc(EngFunc_WriteCoord, originF[0])
  287. engfunc(EngFunc_WriteCoord, originF[1])
  288. engfunc(EngFunc_WriteCoord, originF[2]+10)
  289. write_short(250)
  290. write_byte(70)
  291. write_byte(55)
  292. message_end()
  293.  
  294. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  295. write_byte(TE_PARTICLEBURST)
  296. engfunc(EngFunc_WriteCoord, originF[0])
  297. engfunc(EngFunc_WriteCoord, originF[1])
  298. engfunc(EngFunc_WriteCoord, originF[2]+10)
  299. write_short(250)
  300. write_byte(83)
  301. write_byte(55)
  302. message_end()
  303.  
  304. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  305. write_byte(TE_IMPLOSION)
  306. engfunc(EngFunc_WriteCoord, originF[0])
  307. engfunc(EngFunc_WriteCoord, originF[1])
  308. engfunc(EngFunc_WriteCoord, originF[2]+10)
  309. write_byte(random_num(100, 300))
  310. write_byte(20)
  311. write_byte(3)
  312. message_end()
  313. }
  314.  
  315. public fw_AWP_PrimaryAttack_Post(awp)
  316. {
  317. if(get_pcvar_num(cvar_thunder))
  318. {
  319. static id
  320. id = get_pdata_cbase(awp, q_pPlayer, 4)
  321.  
  322. if(is_user_connected(id) && g_lasergun[id])
  323. {
  324. new iEndOrigin[3]
  325. get_user_origin(id, iEndOrigin, 3)
  326.  
  327. message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
  328. write_byte(TE_EXPLOSION)
  329. write_coord(iEndOrigin[0])
  330. write_coord(iEndOrigin[1])
  331. write_coord(iEndOrigin[2] +10)
  332. write_short(thunder)
  333. write_byte(90)
  334. write_byte(60)
  335. write_byte(TE_EXPLFLAG_NONE)
  336. message_end()
  337.  
  338. message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
  339. write_byte(TE_EXPLOSION)
  340. write_coord(iEndOrigin[0])
  341. write_coord(iEndOrigin[1])
  342. write_coord(iEndOrigin[2]+20)
  343. write_short(thunder)
  344. write_byte(60)
  345. write_byte(20)
  346. write_byte(TE_EXPLFLAG_NONE)
  347. message_end()
  348.  
  349. message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
  350. write_byte(TE_EXPLOSION)
  351. write_coord(iEndOrigin[0])
  352. write_coord(iEndOrigin[1])
  353. write_coord(iEndOrigin[2] +30)
  354. write_short(thunder)
  355. write_byte(60)
  356. write_byte(20)
  357. write_byte(TE_EXPLFLAG_NONE)
  358. message_end()
  359.  
  360. message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
  361. write_byte(TE_BEAMCYLINDER)
  362. write_coord(iEndOrigin[0])
  363. write_coord(iEndOrigin[1])
  364. write_coord(iEndOrigin[2])
  365. write_coord(iEndOrigin[0])
  366. write_coord(iEndOrigin[1])
  367. write_coord(iEndOrigin[2]+200)
  368. write_short(hotflarex)
  369. write_byte(0)
  370. write_byte(1)
  371. write_byte(6)
  372. write_byte(8)
  373. write_byte(1)
  374. write_byte(255)
  375. write_byte(255)
  376. write_byte(192)
  377. write_byte(128)
  378. write_byte(5)
  379. message_end()
  380.  
  381. message_begin( MSG_ONE_UNRELIABLE, Shakes, _, id )
  382. write_short( Second*5 )
  383. write_short( Second*5 )
  384. write_short( Second*5 )
  385. message_end( )
  386. }
  387. }
  388. }
  389.  
  390. public fw_PlayerSpawn_Post(id)
  391. {
  392. if(get_pcvar_num(cvar_oneround))
  393. {
  394. if(g_lasergun[id])
  395. {
  396. g_lasergun[id] = false
  397. ham_strip_weapon(id, "weapon_awp")
  398. }
  399. }
  400. }
  401.  
  402. stock ham_strip_weapon(id, weapon[])
  403. {
  404. if(!equal(weapon,"weapon_",7))
  405. return 0
  406.  
  407. new idd = get_weaponid(weapon)
  408.  
  409. if(!idd) return 0
  410.  
  411. new wEnt
  412.  
  413. while((wEnt = find_ent_by_class(wEnt, weapon)) && entity_get_edict(wEnt, EV_ENT_owner) != id) {}
  414.  
  415. if(!wEnt) return 0
  416.  
  417. if(get_user_weapon(id) == idd)
  418. ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
  419.  
  420. if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))
  421. return 0
  422.  
  423. ExecuteHamB(Ham_Item_Kill, wEnt)
  424.  
  425. entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) & ~(1<<idd))
  426.  
  427. return 1
  428. }
  429. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  430. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
  431. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement