[AMXX] New NightVision Google (No Lag)

A Config Script for Counter-Strike 1.6

SEX! Ok, we got your attention. We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending rj. points.
  • Post: Give rj. your thoughts on this Script.
  • Vote: Help rj. win the Monthly Awards.
  • Rate: Give this Script a rating out of 10.
  • Flag: Alert moderators and warn members of a problem with this Script.
  • Watch: Get notified when this Script is updated.
Mascot

Join the community!

Sign up

Already a Bananite? Login

114 lines | 2 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
#include <amxmodx>
#include <fakemeta>

new const PLUGIN_VERSION[] = "1.0"

new g_nightvision[33]

new g_default_map_light[32]

new g_fwLightStyle

new g_msgScreenFade

public plugin_precache()
{
        register_plugin("New NightVision", PLUGIN_VERSION, "Fai")
       
        g_fwLightStyle = register_forward(FM_LightStyle, "fw_LightStyle")
}

public plugin_init()
{
        unregister_forward(FM_LightStyle, g_fwLightStyle)
       
        g_msgScreenFade = get_user_msgid("ScreenFade")
       
        register_message(g_msgScreenFade, "message_screenfade")
        register_message(get_user_msgid("NVGToggle"), "message_nvgtoggle")
       
        set_cvar_num("sv_skycolor_r", 0)
        set_cvar_num("sv_skycolor_g", 0)
        set_cvar_num("sv_skycolor_b", 0)
}

public fw_LightStyle(style, const val[])
{
        if (!style)
                copy(g_default_map_light, charsmax(g_default_map_light), val)
}

public message_screenfade(msg_id, msg_dest, msg_entity)
{
        if (!g_nightvision[msg_entity])
                return PLUGIN_CONTINUE;
       
        if (get_msg_arg_int(4) != 255 || get_msg_arg_int(5) != 255 || get_msg_arg_int(6) != 255 || get_msg_arg_int(7) < 200)
                return PLUGIN_CONTINUE;
       
        remove_task(msg_entity)
        set_task(get_msg_arg_int(1) / 4096.0, "task_restore_screenfade", msg_entity)
       
        return PLUGIN_CONTINUE;
}

public message_nvgtoggle(msg_id, msg_dest, msg_entity)
{
        static flag
        flag = get_msg_arg_int(1)
       
        message_begin(MSG_ONE_UNRELIABLE, SVC_LIGHTSTYLE, _, msg_entity)
        write_byte(0)
       
        if (flag)
                write_string("#")
        else
                write_string(g_default_map_light)
       
        message_end()
       
        if (!task_exists(msg_entity))
        {
                message_begin(MSG_ONE, g_msgScreenFade, _, msg_entity)
                write_short((1<<12))
                write_short(0)
                write_short(0x0004)
               
                if (flag)
                {
                        write_byte(128)
                        write_byte(255)
                        write_byte(128)
                        write_byte(73)
                }
                else
                {
                        write_byte(0)
                        write_byte(0)
                        write_byte(0)
                        write_byte(0)
                }
               
                message_end()
        }
       
        g_nightvision[msg_entity] = flag
       
        return PLUGIN_HANDLED;
}

public task_restore_screenfade(id)
{
        if (!g_nightvision[id])
                return;
       
        message_begin(MSG_ONE, g_msgScreenFade, _, id)
        write_short((1<<12))
        write_short(0)
        write_short(0x0004)
        write_byte(128)
        write_byte(255)
        write_byte(128)
        write_byte(73)
        message_end()
}
DESCRIPTION
By using this plugin, the original CS NVG inside the game will get replaced.
Notice: This plugin cannot be used in Zombie Plague because of the ZP's lighting system which is not working sucessfully with my plugin,
but you can also make the lighting system work correctly by modifiyng the code such as replacing EngFunc_LightStyle to SVC_LIGHTSTYLE,
so you will be able to use a for-loop check and set a correct light level for each player.

Hope you guys like this. 

Posts

None found

Share

Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share

Credits

Original Authors
Fai a.k.a. B.B.O
AMXX Script/Codes

Submitter

rj. avatar
rj. PAUSE
Member Joined 1y
373 points Ranked 11291st
38 medals 4 legendary 10 rare
  • Submitted 15 Tools Medal icon
  • Submitted 50 Gamefiles Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2016 Medal icon
  • Thanked 500 submitters Medal icon
  • 2nd Place - Game Poetry Contest Medal icon
  • Submitted 5 Tools Medal icon

rj.
Redistributor
Are you the owner? Request Ownership
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Attributes

Language
Pawn (AMXMODX)

Stats

Posts
0
Views
705
Date Added
8mo
bcp.crwdcntrl.net tracking pixel