Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[ZP]: Sniper Laser Gun
#2
PHP Code:
#include <amxmodx>
#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 cvar_limit,cvar_damage;
new 
used[33];
new 
bullets[33]
new 
hotflarexlaserbthunder
new bool:g_lasergun[33]
new 
g_iMaxPlayers
const q_pPlayer 41
new Shakes
const Second = ( 1<<10 )
new 
cvar_particles_deadcvar_bullet_efectcvar_thundercvar_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("Sniper Laser Gun"40ZP_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")
    
cvar_damage register_cvar("zp_slg_damage","1000.0")
    
cvar_limit register_cvar("zp_slg_limit","8")
    
}

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(iditemid
{
    
    if (
itemid ==g_ibuy)
    {
        
g_lasergun[id] = true
        give_item 
(id"weapon_awp")
        
cs_set_user_bpammo(idCSW_AWP20)
        
client_print(idprint_center"[ZP] Sniper Laser Gun ON! Killed All Zombies!")
    }
    
    if(
g_lasergun[id] && user_has_weapon(idCSW_AWP))
    {
        
client_print(idprint_chat"/g[ZP]/y You Already Have Sniper Laser Gun!")
        
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + 40)
        return;
    }


public 
zp_user_infected_post(infectedinfector)
{
    if (
g_lasergun[infected])
    {
        
g_lasergun[infected] = false
    
}
}

public 
event_round_start()
{
    for (new 
1<= g_iMaxPlayersi++)
    {
        if (!
is_user_connected(i))
            continue
        
        if (
g_lasergun[i])
        {
            
g_lasergun false
        
}
        
used 0;
    }
}

public 
client_putinserver(id)
{
    
used[id] = 0;
    
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(idpteam15)
            
            if ((
bullets[id] > clip) && (wpnid == CSW_AWP)) 
            {
                new 
laser1[3], laser2[3]
                
get_user_origin(idlaser11)
                
get_user_origin(idlaser24)
                
                
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
                
write_byte (1)    
                
write_short(id 0x1000
                
write_coord (laser2[0]) 
                
write_coord (laser2[1])
                
write_coord (laser2[2])
                
write_shortlaserb )
                
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_BROADCASTSVC_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_BROADCASTSVC_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(idCHAN_AUTOLaserSoundVOL_NORMATTN_NORM 0PITCH_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
(idEV_SZ_viewmodelV_LASERGUN)
    
entity_set_string(idEV_SZ_weaponmodelP_LASERGUN)
    
    return 
PLUGIN_CONTINUE 
}

public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED
    
    
    
if(!equali(model"models/w_awp.mdl")) 
        return 
FMRES_IGNORED;
    
    new 
ads entity_get_edict(entityEV_ENT_owner)
    new 
className[33]
    
entity_get_string(entityEV_SZ_classnameclassName32)
    
    if(
equal(className"weaponbox") || equal(className"armoury_entity") || equal(className"grenade"))
    {
        if(
g_lasergun[ads])
        {
            
entity_set_model(entityW_LASERGUN)
            return 
FMRES_SUPERCEDE
        
}
    }
    
    return 
FMRES_IGNORED


public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_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(victimpev_originoriginF)
        
        new 
plrWeapIdplrClipplrAmmo
        plrWeapId 
get_user_weapon(attackerplrClipplrAmmo)
        if (
plrWeapId == CSW_AWP)
            
SetHamParamFloat(4damage get_pcvar_float(cvar_damage))
        
        
client_print(attackerprint_center"Enemy Electrocuted!")
        if(
get_pcvar_num(cvar_particles_dead))
            
dead_efect(originF)
    }
    
    if(
zp_get_user_nemesis(victim))
    {
        
client_print(attackerprint_center"Nemesis is Inmune")
    }
    return 
PLUGIN_HANDLED
}

dead_efect(const Float:originF[3])
{    
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)            
    
write_byte(TE_PARTICLEBURST
    
engfunc(EngFunc_WriteCoordoriginF[0])
    
engfunc(EngFunc_WriteCoordoriginF[1]) 
    
engfunc(EngFunc_WriteCoordoriginF[2]+10
    
write_short(250
    
write_byte(70
    
write_byte(55
    
message_end()
    
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)            
    
write_byte(TE_PARTICLEBURST
    
engfunc(EngFunc_WriteCoordoriginF[0])
    
engfunc(EngFunc_WriteCoordoriginF[1]) 
    
engfunc(EngFunc_WriteCoordoriginF[2]+10)
    
write_short(250
    
write_byte(70
    
write_byte(55
    
message_end()
    
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)            
    
write_byte(TE_PARTICLEBURST)
    
engfunc(EngFunc_WriteCoordoriginF[0]) 
    
engfunc(EngFunc_WriteCoordoriginF[1]) 
    
engfunc(EngFunc_WriteCoordoriginF[2]+10)
    
write_short(250)
    
write_byte(83
    
write_byte(55)
    
message_end()
    
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_IMPLOSION)
    
engfunc(EngFunc_WriteCoordoriginF[0]) 
    
engfunc(EngFunc_WriteCoordoriginF[1]) 
    
engfunc(EngFunc_WriteCoordoriginF[2]+10
    
write_byte(random_num(100300))
    
write_byte(20
    
write_byte(3
    
message_end()
}

public 
fw_AWP_PrimaryAttack_Post(awp)
{
    static 
id
    id 
get_pdata_cbase(awpq_pPlayer4)
    if(
used[id] >= get_pcvar_num(cvar_limit)) {
        
client_print(id,print_chat,"Bu Silahi Kullanma Limitiniz Doldu !")
        return 
HAM_IGNORED
    
}
    
used[id]++;
    
    if(
get_pcvar_num(cvar_thunder))
    {
        
        
        if(
is_user_connected(id) && g_lasergun[id])
        {    
            new 
iEndOrigin[3]
            
get_user_origin(idiEndOrigin3)
            
            
message_begin(MSG_BROADCASTSVC_TEMPENTITYiEndOrigin
            
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_BROADCASTSVC_TEMPENTITYiEndOrigin
            
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_BROADCASTSVC_TEMPENTITYiEndOrigin
            
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_BROADCASTSVC_TEMPENTITYiEndOrigin
            
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_beginMSG_ONE_UNRELIABLEShakes_id )
            
write_shortSecond*)
            
write_shortSecond*)
            
write_shortSecond*)
            
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(idweapon[])
{
    if(!
equal(weapon,"weapon_",7)) 
        return 
0
    
    
new idd get_weaponid(weapon)
    
    if(!
idd) return 0
    
    
new wEnt
    
    
while((wEnt find_ent_by_class(wEntweapon)) && entity_get_edict(wEntEV_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_KillwEnt)
    
    
entity_set_int(idEV_INT_weaponsentity_get_int(idEV_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 }
*/ 

Denemeye fırsatım olmadı. Bir dene bak. Amxx istersen ekte.[/i][/i][/i]


CS:GO ve CS 1.6 için ücretli eklenti yapılır.
Plugin yazmak isteyenlere yardımcı olabilirim.
Skype adresimden ulaşabilirsiniz:
destek_596
Steam: http://steamcommunity.com/id/ca-nemesis/

Reply


Messages In This Thread
[ZP]: Sniper Laser Gun - by nomaxx - 04-01-13, 21:39
Cevap: [ZP]: Sniper Laser Gun - by akcaliberkk - 04-01-13, 22:30
Cevap: [ZP]: Sniper Laser Gun - by nomaxx - 04-01-13, 22:56
Cevap: [ZP]: Sniper Laser Gun - by nomaxx - 04-01-13, 23:22
Cevap: [ZP]: Sniper Laser Gun - by nomaxx - 04-01-13, 23:55
Cevap: [ZP]: Sniper Laser Gun - by nomaxx - 05-01-13, 00:10
Cevap: [ZP]: Sniper Laser Gun - by nomaxx - 05-01-13, 00:25
Cevap: [ZP]: Sniper Laser Gun - by nomaxx - 05-01-13, 00:52

Possibly Related Threads…
Thread Author Replies Views Last Post
  [ZP] Laser Plugini Sorunu buyukkaptan90 12 8,263 20-03-13, 15:30
Last Post: buyukkaptan90
  Amxmodu Kurunca Sniper Zoomunu yavaş açıyor yardım kafkef12 9 4,827 19-05-12, 12:44
Last Post: kanka3838

Foruma Atla:


Users browsing this thread: 1 Guest(s)