GameBanana shows no ads to members. Sign up now!
Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

[ZP] Laser sight

A Config Script for Counter-Strike 1.6

115 3 kb Raw Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
#include <engine>
#include <zombieplague>


#define PLUGIN   "[ZP]Laser"
#define VERSION  "0.1"
#define AUTHOR   "Barney"

new bool:laser[33], item,weapon[33], g_lw[512], weapona[][33]

new const WEAPONENTNAMES[][] = {"weapon_p228","weapon_scout", "weapon_xm1014", "weapon_mac10","weapon_aug", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550","weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249","weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_deagle", "weapon_sg552","weapon_ak47", "weapon_p90" }

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
        for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
                RegisterHam(Ham_Item_AddToPlayer, WEAPONENTNAMES[i], "fw_wpnadd")
        RegisterHam(Ham_Player_PreThink,"player","fw_think",1)
        RegisterHam(Ham_Spawn,"player","fw_spawn",1)
       
        register_forward(FM_SetModel, "fw_SetModel")
       
        item = zp_register_extra_item("Laser sight",1,ZP_TEAM_HUMAN)
       
}

public fw_spawn(id)
{
        if(is_user_alive(id)){
                laser[id]=false
                weapon[id]=0
                weapona[id]=""
        }
}

public fw_wpnadd(wpn,id){
        if(g_lw[wpn])
        {
                new cn[33]
                pev(wpn,pev_classname,cn,32)
                laser[id]=true
                g_lw[id]=0
                weapon[id]=get_weaponid(cn)
                get_weaponname(weapon[id],weapona[id],15)
        }
}

public fw_SetModel(entity)
{
        if(!pev_valid(entity))
                return FMRES_IGNORED
       
        new szClassName[33]
        pev(entity,pev_classname,szClassName,32)
               
        if(!equal(szClassName, "weaponbox"))
                return FMRES_IGNORED
       
        static iOwner,ent
        iOwner = pev(entity,pev_owner)
        ent = find_ent_by_owner(-1,weapona[iOwner],iOwner)
        if(laser[iOwner])
        {
               
                laser[iOwner]=false
                weapon[iOwner]=0
                weapona[iOwner]=""
                g_lw[ent]=1
        }
       
        return FMRES_IGNORED
}

public zp_extra_item_selected(id,itid)
{
       
        if(itid==item)
        {
                if(get_user_weapon(id)==CSW_C4||get_user_weapon(id)==CSW_HEGRENADE||get_user_weapon(id)==CSW_FLASHBANG||get_user_weapon(id)==CSW_SMOKEGRENADE||get_user_weapon(id)==CSW_KNIFE)
                        return ZP_PLUGIN_HANDLED

                laser[id]=true
                weapon[id]=get_user_weapon(id)
                get_weaponname(weapon[id],weapona[id],15)
               
        }
        return PLUGIN_CONTINUE
}

public fw_think(id)
{
        new Float:origin[3]
        fm_get_aim_origin(id,origin)
        if(get_user_weapon(id) == weapon[id] && laser[id])
        {
                message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
                write_byte(27)
                write_coord(floatround(origin[0]))
                write_coord(floatround(origin[1]))
                write_coord(floatround(origin[2]))
                write_byte(2)
                write_byte(255)
                write_byte(0)
                write_byte(0)
                write_byte(1)
                write_byte(25)
                message_end()
                set_pev(id,pev_punchangle,0.0)
        }
}
Description:
This plugin adds to the server the purchase of a laser sight for a specific weapon. The sight removes the spread of bullets. When testing the plugin, no bugs were found! "
Te_light Version" only
Sign up to access this!

No comments yet

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Credits

Barney
Barney
scripter

Submitter

Rainbowdash98 avatar
Rainbowdash98 Joined 4y ago
Offline
2,719 points Ranked 20080th
10 medals 1 rare
  • Returned 1000 times Medal icon
  • One month a member Medal icon
  • Returned 100 times Medal icon
  • 6 months a member Medal icon
  • 1 year a member Medal icon
  • 2 years a member Medal icon
Rainbowdash98
Redistributor
Are you the owner? Request Ownership
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

License

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • 0
  • 352
  • 1mo
  • 1mo

More from Submitter

More AMX/X Scripts Scripts