AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing limit on nightvision (https://forums.alliedmods.net/showthread.php?t=6919)

Mr. Satan 10-19-2004 07:08

Removing limit on nightvision
 
Would it be possible to remove the "battery life" ?

I run this plugin on my Sven Coop server and it gets annoying when using nightvision in a large dark area and having it cut out all the time.

I tried setting the battery life to 99999999 and the recharge time to 0 but it still cuts out >_<

Code:
/* AMX Mod Script  *  * Nightvision Plugin  *  * 2003 - Lazy ([email protected])  *  * This plugin adds nightvision goggles to mods that don't have it already,  * help is available when users say !help nightvision.  *  * Changelog:  *  * 0.1 : First builds and general setup  * 0.2 : Fixed nightvision effect problem  * 0.3 : Added screenfade effect  * 0.4 : Nightvision tweaks  * 0.5 : Nightvision tweaks  * 0.6 : Removed some useless code  * 0.7 : Added support for SvenCoop  * 0.8 : Fixed stupid bug  * 0.9 : Tweaked battery  * 1.0 : Fixed fatal bug  * 1.1 : Changed commands nvg_on/nvg_off to nightvision */ #include <amxmodx> new gNvgRun[33] new gMsgScreenfade public plugin_init() {     register_plugin("Nightvision", "1.1", "Lazy/AssKicR")         register_cvar("mp_nightvision", "1", FCVAR_SERVER)         register_clcmd("say", "HandleSay", 0, "For Help")     register_clcmd("nightvision","HandleNVG",0,"Toggles Nightvision")         gMsgScreenfade = get_user_msgid("ScreenFade")         register_event("DeathMsg", "Grab_Death", "a")         return PLUGIN_CONTINUE } public HandleNVG(id) {     if (get_cvar_num("mp_nightvision")!=1) {         client_print(id,print_center,"[AMXX] Sry Server has disabled this command")         return PLUGIN_HANDLED     } else {         if (is_user_alive(id) == 1) {             if (gNvgRun[id]) {                 KillNVG(id)                 return PLUGIN_HANDLED             } else {                 InitNVG(id)                 return PLUGIN_HANDLED             }         }     }     return PLUGIN_CONTINUE } public client_connect(id) {     gNvgRun[id] = 0         return PLUGIN_CONTINUE } public client_disconnect(id) {     gNvgRun[id] = 0         remove_task(144)     remove_task(145)     remove_task(147)         return PLUGIN_CONTINUE } public Grab_Death() {     new victim = read_data(2)     KillNVG(victim) } public InitNVG(id) {     new player[32]         get_user_name(id, player, 32)             gNvgRun[id] = 1             emit_sound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)         set_task(0.10, "RunNVG", 144, player, 32, "b")     set_task(0.10, "RunNVG2", 147, player, 32, "b")         return PLUGIN_HANDLED } public RunNVG(player[]) {     new origin[3]     new id         id = get_user_index(player)         get_user_origin(id, origin)         message_begin(MSG_ONE, SVC_TEMPENTITY, {0,0,0}, id)         write_byte( 27 )         write_coord( origin[0] )     write_coord( origin[1] )     write_coord( origin[2] )         write_byte( 125 )     write_byte( 0 )     write_byte( 255 )     write_byte( 0 )         write_byte( 1 )     write_byte( 10 )         message_end()     // Svencoop     if (is_user_alive(id) == 0)     {         emit_sound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)                 remove_task(144)         remove_task(145)         remove_task(147)                 gNvgRun[id] = 0     } } public RunNVG2(player[]) {     new id         id = get_user_index(player)     message_begin(MSG_ONE, gMsgScreenfade, {0,0,0}, id)         write_short(1000)     write_short(1000)     write_short(1<<12)         write_byte(0)     write_byte(255)     write_byte(0)         write_byte(150)         message_end() } public KillNVG(id) {     emit_sound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)         remove_task(144)     remove_task(145)     remove_task(147)         gNvgRun[id] = 0         return PLUGIN_HANDLED } public HandleSay(id) {     new chatstr[256]     new msgbox[256]         read_args(chatstr, 256)         format(msgbox, 256, "Nightvision:^n===========^n^nTo toggle nightvision type nightvision in console.^nWarning, nightvision may slow down some computers.")         if (containi(chatstr, "!help nightvision") == 1)            show_motd(id, msgbox, "Nightvision Help")         return PLUGIN_CONTINUE }

Mr. Satan 11-03-2004 13:14

Sorry for the double post but...please help :(

XxAvalanchexX 11-04-2004 13:18

Perhaps, when you run the NVG2 thing (which I believe is what actually does the nightvision), you could set a task to run it again in however many seconds it is before it expires.

Mr. Satan 11-06-2004 09:35

Nah, I figured it out.

Code:
/* AMX Mod Script  *  * Nightvision Plugin  *  * 2003 - Lazy ([email protected])  *  * This plugin adds nightvision goggles to mods that don't have it already,  * help is available when users say !help nightvision.  *  * Changelog:  *  * 0.1 : First builds and general setup  * 0.2 : Fixed nightvision effect problem  * 0.3 : Added screenfade effect  * 0.4 : Nightvision tweaks  * 0.5 : Nightvision tweaks  * 0.6 : Removed some useless code  * 0.7 : Added support for SvenCoop  * 0.8 : Fixed stupid bug  * 0.9 : Tweaked battery  * 1.0 : Fixed fatal bug  * 1.1 : Changed commands nvg_on/nvg_off to nightvision  * 1.2 : Removed the "timelimit" - NV will only turn off on death. ~ Mr. Satan  * 1.3 : Darkened nightvision. Same effect but not as bright. ~ Mr. Satan */ #include <amxmodx> new gNvgRun[33] new gMsgScreenfade public plugin_init() {     register_plugin("Nightvision", "1.3", "Lazy/AssKicR/Mr. Satan")         register_cvar("mp_nightvision", "1", FCVAR_SERVER)         register_clcmd("say", "HandleSay", 0, "For Help")     register_clcmd("nightvision","HandleNVG",0,"Toggles Nightvision")         gMsgScreenfade = get_user_msgid("ScreenFade")         register_event("DeathMsg", "Grab_Death", "a")         return PLUGIN_CONTINUE } public HandleNVG(id) {     if (get_cvar_num("mp_nightvision")!=1) {         client_print(id,print_center,"[AMXX] Sorry, server has disabled this command")         return PLUGIN_HANDLED     } else {         if (is_user_alive(id) == 1) {             if (gNvgRun[id]) {                 KillNVG(id)                 return PLUGIN_HANDLED             } else {                 InitNVG(id)                 return PLUGIN_HANDLED             }         }     }     return PLUGIN_CONTINUE } public client_connect(id) {     gNvgRun[id] = 0         return PLUGIN_CONTINUE } public client_disconnect(id) {     gNvgRun[id] = 0         remove_task(144)     remove_task(145)     remove_task(147)         return PLUGIN_CONTINUE } public Grab_Death() {     new victim = read_data(2)     KillNVG(victim) } public InitNVG(id) {     new player[32]         get_user_name(id, player, 32)             gNvgRun[id] = 1             emit_sound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)         set_task(0.10, "RunNVG", 144, player, 32, "b")     set_task(0.10, "RunNVG2", 147, player, 32, "b")         return PLUGIN_HANDLED } public RunNVG(player[]) {     new origin[3]     new id         id = get_user_index(player)         get_user_origin(id, origin)         message_begin(MSG_ONE, SVC_TEMPENTITY, {0,0,0}, id)         write_byte( 27 )         write_coord( origin[0] )     write_coord( origin[1] )     write_coord( origin[2] )         write_byte( 125 )     write_byte( 0 )     write_byte( 255 )     write_byte( 0 )         write_byte( 1 )     write_byte( 0 )         message_end()     // Svencoop     if (is_user_alive(id) == 0)     {         emit_sound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)                 remove_task(144)         remove_task(145)         remove_task(147)                 gNvgRun[id] = 0     } } public RunNVG2(player[]) {     new id         id = get_user_index(player)     message_begin(MSG_ONE, gMsgScreenfade, {0,0,0}, id)         write_short(1000)     write_short(1000)     write_short(1<<12)         write_byte(0)     write_byte(255)     write_byte(0)         write_byte(9999)         message_end() } public KillNVG(id) {     emit_sound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)         remove_task(144)     remove_task(145)     remove_task(147)         gNvgRun[id] = 0         return PLUGIN_HANDLED } public HandleSay(id) {     new chatstr[256]     new msgbox[256]         read_args(chatstr, 256)         format(msgbox, 256, "Nightvision:^n===========^n^nTo toggle nightvision type nightvision in console.^nWarning, nightvision may slow down some computers.")         if (containi(chatstr, "!help nightvision") == 1)            show_motd(id, msgbox, "Nightvision Help")         return PLUGIN_CONTINUE }

Mr. Satan 11-11-2004 18:24

Also, here's a screenshot to show the reduced nightvision brightness. The responses I have recieved after reducing the brightness have all been positive.

http://img19.exs.cx/img19/5805/NV_Example.jpg

Kamikaze 11-12-2004 01:37

You going to post this in the plugins forum, looks like a great plugin.

Mr. Satan 11-12-2004 01:39

I didn't make the plugin, I only edited it.


All times are GMT -4. The time now is 17:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.