Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <zombieplague>
- #include <fun>
- #include <cstrike>
- #include <engine>
- #include <hamsandwich>
- #include <fakemeta>
- /* [ZP] Extra Item : Sniper Laser Gun [SLG] ! By xLeoNNN. (san antonio,chile)
- this is my second plugin, the Sniper Laser Gun [SLG] is a weapon awp with efects,laser,
- Credits :
- meTaLiCroSS : for code of damage of "gauss"
- Mr.Death : how to create the effects and use the "Temp Entity"
- */
- new g_ibuy
- new bullets[33]
- new hotflarex, laserb, thunder
- new bool:g_lasergun[33]
- new g_iMaxPlayers
- const q_pPlayer = 41
- new Shakes
- const Second = ( 1<<10 )
- new cvar_particles_dead, cvar_bullet_efect, cvar_thunder, cvar_oneround
- new g_currentweapon[33]
- new V_LASERGUN[] = "models/zombie_plague/v_sniper_laser_gun.mdl"
- new P_LASERGUN[] = "models/zombie_plague/p_sniper_laser_gun.mdl"
- new W_LASERGUN[] = "models/zombie_plague/w_sniper_laser_gun.mdl"
- new const LaserSound[] = "weapons/electro4.wav"
- public plugin_init()
- {
- register_plugin("[ZP] Extra Item: Sniper Laser Gun", "1.0", "x[L]eoNNN")
- g_ibuy = zp_register_extra_item("\y[GOLD] \rSniperLaserGun", 200, ZP_TEAM_HUMAN)
- Shakes = get_user_msgid( "ScreenShake" )
- register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
- register_event("CurWeapon", "Event_CurWeapon", "be","1=1")
- register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
- RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
- RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "fw_AWP_PrimaryAttack_Post", 1)
- RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
- register_forward(FM_SetModel, "fw_SetModel")
- cvar_particles_dead = register_cvar("zp_slg_particles", "1")
- cvar_bullet_efect = register_cvar("zp_slg_bullet", "1")
- cvar_thunder = register_cvar("zp_slg_thunder", "1")
- cvar_oneround = register_cvar("zp_slg_oneround", "1")
- }
- public plugin_precache()
- {
- hotflarex = precache_model("sprites/flare6.spr")
- laserb = precache_model("sprites/laserbeam.spr")
- thunder = precache_model("sprites/zbeam1.spr")
- precache_model(V_LASERGUN)
- precache_model(P_LASERGUN)
- precache_model(W_LASERGUN)
- precache_sound(LaserSound)
- }
- public zp_extra_item_selected(id, itemid)
- {
- if (itemid ==g_ibuy)
- {
- if(get_user_flags(id) & read_flags("p"))
- {
- g_lasergun[id] = true
- give_item (id, "weapon_awp")
- cs_set_user_bpammo(id, CSW_AWP, 20)
- client_print(id, print_center, "[ZP] Sniper Laser Gun ON! Killed All Zombies!")
- }
- else
- {
- return PLUGIN_HANDLED
- }
- }
- if(g_lasergun[id] && user_has_weapon(id, CSW_AWP))
- {
- client_print(id, print_chat, "\g[GOLD]\y You Already Have Sniper Laser Gun!")
- zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 40)
- return PLUGIN_CONTINUE
- }
- return PLUGIN_CONTINUE
- }
- public zp_user_infected_post(infected, infector)
- {
- if (g_lasergun[infected])
- {
- g_lasergun[infected] = false
- }
- }
- public motd(id)
- {
- new configsdir[200]
- new MOTDfile[200]
- get_configsdir(configsdir,199)
- format(MOTDfile,199,"%s/motd/gold.html",configsdir)
- show_motd(id,MOTDfile)
- return PLUGIN_HANDLED
- }
- public event_round_start()
- {
- for (new i = 1; i <= g_iMaxPlayers; i++)
- {
- if (!is_user_connected(i))
- continue
- if (g_lasergun[i])
- {
- g_lasergun[i] = false
- }
- }
- }
- public client_putinserver(id)
- {
- g_lasergun[id] = false
- }
- public client_disconnect(id)
- {
- g_lasergun[id] = false
- }
- public make_tracer(id)
- {
- if(get_pcvar_num(cvar_bullet_efect))
- {
- if(g_lasergun[id] && g_currentweapon[id])
- {
- new clip,ammo
- new wpnid = get_user_weapon(id,clip,ammo)
- new pteam[16]
- get_user_team(id, pteam, 15)
- if ((bullets[id] > clip) && (wpnid == CSW_AWP))
- {
- new laser1[3], laser2[3]
- get_user_origin(id, laser1, 1)
- get_user_origin(id, laser2, 4)
- message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte (1)
- write_short(id | 0x1000)
- write_coord (laser2[0])
- write_coord (laser2[1])
- write_coord (laser2[2])
- write_short( laserb )
- write_byte(1)
- write_byte(5)
- write_byte(1)
- write_byte(80)
- write_byte(20)
- write_byte(0)
- write_byte(52)
- write_byte(255)
- write_byte(255)
- write_byte(150)
- message_end()
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_DLIGHT)
- write_coord(laser1[0])
- write_coord(laser1[1])
- write_coord(laser1[2])
- write_byte(13)
- write_byte(254)
- write_byte(0)
- write_byte(0)
- write_byte(100)
- write_byte(10)
- message_end()
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_SPRITETRAIL)
- write_coord(laser1[0])
- write_coord(laser1[1])
- write_coord(laser1[2])
- write_coord(laser1[0])
- write_coord(laser1[1])
- write_coord(laser1[2])
- write_short(hotflarex)
- write_byte(5)
- write_byte(1)
- write_byte(3)
- write_byte(34)
- write_byte(43)
- message_end()
- emit_sound(id, CHAN_AUTO, LaserSound, VOL_NORM, ATTN_NORM , 0, PITCH_NORM)
- }
- bullets[id] = clip
- }
- }
- }
- public Event_CurWeapon(id)
- {
- g_currentweapon[id] = read_data(2)
- if(!g_lasergun[id] || g_currentweapon[id] != CSW_AWP)
- return PLUGIN_CONTINUE
- entity_set_string(id, EV_SZ_viewmodel, V_LASERGUN)
- entity_set_string(id, EV_SZ_weaponmodel, P_LASERGUN)
- return PLUGIN_CONTINUE
- }
- public fw_SetModel(entity, model[])
- {
- if(!is_valid_ent(entity))
- return FMRES_IGNORED
- if(!equali(model, "models/w_awp.mdl"))
- return FMRES_IGNORED;
- new ads = entity_get_edict(entity, EV_ENT_owner)
- new className[33]
- entity_get_string(entity, EV_SZ_classname, className, 32)
- if(equal(className, "weaponbox") || equal(className, "armoury_entity") || equal(className, "grenade"))
- {
- if(g_lasergun[ads])
- {
- entity_set_model(entity, W_LASERGUN)
- return FMRES_SUPERCEDE
- }
- }
- return FMRES_IGNORED
- }
- public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
- {
- if(!is_user_connected(attacker) || !is_user_connected(victim) || zp_get_user_nemesis(victim) || attacker == victim || !attacker)
- return HAM_IGNORED
- if (g_lasergun[attacker] && g_currentweapon[attacker] == CSW_AWP)
- {
- static Float:originF[3]
- pev(victim, pev_origin, originF)
- new plrWeapId, plrClip, plrAmmo
- plrWeapId = get_user_weapon(attacker, plrClip, plrAmmo)
- if (plrWeapId == CSW_AWP)
- SetHamParamFloat(4, damage += get_user_health(victim))
- client_print(attacker, print_center, "Enemy Electrocuted!")
- if(get_pcvar_num(cvar_particles_dead))
- dead_efect(originF)
- }
- if(zp_get_user_nemesis(victim))
- {
- client_print(attacker, print_center, "Nemesis is Inmune")
- }
- return PLUGIN_HANDLED;
- }
- dead_efect(const Float:originF[3])
- {
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_PARTICLEBURST)
- engfunc(EngFunc_WriteCoord, originF[0])
- engfunc(EngFunc_WriteCoord, originF[1])
- engfunc(EngFunc_WriteCoord, originF[2]+10)
- write_short(250)
- write_byte(70)
- write_byte(55)
- message_end()
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_PARTICLEBURST)
- engfunc(EngFunc_WriteCoord, originF[0])
- engfunc(EngFunc_WriteCoord, originF[1])
- engfunc(EngFunc_WriteCoord, originF[2]+10)
- write_short(250)
- write_byte(70)
- write_byte(55)
- message_end()
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_PARTICLEBURST)
- engfunc(EngFunc_WriteCoord, originF[0])
- engfunc(EngFunc_WriteCoord, originF[1])
- engfunc(EngFunc_WriteCoord, originF[2]+10)
- write_short(250)
- write_byte(83)
- write_byte(55)
- message_end()
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_IMPLOSION)
- engfunc(EngFunc_WriteCoord, originF[0])
- engfunc(EngFunc_WriteCoord, originF[1])
- engfunc(EngFunc_WriteCoord, originF[2]+10)
- write_byte(random_num(100, 300))
- write_byte(20)
- write_byte(3)
- message_end()
- }
- public fw_AWP_PrimaryAttack_Post(awp)
- {
- if(get_pcvar_num(cvar_thunder))
- {
- static id
- id = get_pdata_cbase(awp, q_pPlayer, 4)
- if(is_user_connected(id) && g_lasergun[id])
- {
- new iEndOrigin[3]
- get_user_origin(id, iEndOrigin, 3)
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
- write_byte(TE_EXPLOSION)
- write_coord(iEndOrigin[0])
- write_coord(iEndOrigin[1])
- write_coord(iEndOrigin[2] +10)
- write_short(thunder)
- write_byte(90)
- write_byte(60)
- write_byte(TE_EXPLFLAG_NONE)
- message_end()
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
- write_byte(TE_EXPLOSION)
- write_coord(iEndOrigin[0])
- write_coord(iEndOrigin[1])
- write_coord(iEndOrigin[2]+20)
- write_short(thunder)
- write_byte(60)
- write_byte(20)
- write_byte(TE_EXPLFLAG_NONE)
- message_end()
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
- write_byte(TE_EXPLOSION)
- write_coord(iEndOrigin[0])
- write_coord(iEndOrigin[1])
- write_coord(iEndOrigin[2] +30)
- write_short(thunder)
- write_byte(60)
- write_byte(20)
- write_byte(TE_EXPLFLAG_NONE)
- message_end()
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
- write_byte(TE_BEAMCYLINDER)
- write_coord(iEndOrigin[0])
- write_coord(iEndOrigin[1])
- write_coord(iEndOrigin[2])
- write_coord(iEndOrigin[0])
- write_coord(iEndOrigin[1])
- write_coord(iEndOrigin[2]+200)
- write_short(hotflarex)
- write_byte(0)
- write_byte(1)
- write_byte(6)
- write_byte(8)
- write_byte(1)
- write_byte(255)
- write_byte(255)
- write_byte(192)
- write_byte(128)
- write_byte(5)
- message_end()
- message_begin( MSG_ONE_UNRELIABLE, Shakes, _, id )
- write_short( Second*5 )
- write_short( Second*5 )
- write_short( Second*5 )
- message_end( )
- }
- }
- }
- public fw_PlayerSpawn_Post(id)
- {
- if(get_pcvar_num(cvar_oneround))
- {
- if(g_lasergun[id])
- {
- g_lasergun[id] = false
- ham_strip_weapon(id, "weapon_awp")
- }
- }
- }
- stock ham_strip_weapon(id, weapon[])
- {
- if(!equal(weapon,"weapon_",7))
- return 0
- new idd = get_weaponid(weapon)
- if(!idd) return 0
- new wEnt
- while((wEnt = find_ent_by_class(wEnt, weapon)) && entity_get_edict(wEnt, EV_ENT_owner) != id) {}
- if(!wEnt) return 0
- if(get_user_weapon(id) == idd)
- ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
- if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))
- return 0
- ExecuteHamB(Ham_Item_Kill, wEnt)
- entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) & ~(1<<idd))
- return 1
- }
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement