Raised This Month: $ Target: $400
 0% 

Nightvision One Person Only :(


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr. Satan
Senior Member
Join Date: Apr 2004
Location: Fort Wayne, Indiana
Old 02-18-2005 , 01:33   Nightvision One Person Only :(
Reply With Quote #1

I love this nightvision plugin, but it seems only one person can use it at a time.

For example, me and another player are in a dark area, I turn on nightvision then the other player turns on nightvision. As a result my nightvision turns off. If I turn mine back on theirs goes off. Also, when someone dies and I have nightvision on, it will turn off.

Can someone please fix this?

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(999999)         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 }
__________________
DITN's TEAMSPEAK Server @ ditn.sytes.net:8767
Mr. Satan is offline
Send a message via AIM to Mr. Satan Send a message via MSN to Mr. Satan Send a message via Yahoo to Mr. Satan
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-18-2005 , 15:22  
Reply With Quote #2

Try this:

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> #define TASKID1 100 #define TASKID2 200 #define TASKID3 300 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(TASKID1+id)     remove_task(TASKID2+id)     remove_task(TASKID3+id)           return PLUGIN_CONTINUE } public Grab_Death() {     new victim = read_data(2)     KillNVG(victim) } public InitNVG(id) {     new player[32]           get_user_name(id, player, 31)               gNvgRun[id] = 1               emit_sound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)           set_task(0.10, "RunNVG", TASKID1+id, player, 32, "b")     set_task(0.10, "RunNVG2", TASKID3+id, 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(TASKID1+id)         remove_task(TASKID2+id)         remove_task(TASKID3+id)                   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(999999)           message_end() } public KillNVG(id) {     emit_sound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)           remove_task(TASKID1+id)     remove_task(TASKID2+id)     remove_task(TASKID3+id)           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 }

This gives each different player a different task ID so that when it removes one player's tasks it won't remove the other player's tasks.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Mr. Satan
Senior Member
Join Date: Apr 2004
Location: Fort Wayne, Indiana
Old 02-19-2005 , 12:21  
Reply With Quote #3

It works! Thank you very much!
__________________
DITN's TEAMSPEAK Server @ ditn.sytes.net:8767
Mr. Satan is offline
Send a message via AIM to Mr. Satan Send a message via MSN to Mr. Satan Send a message via Yahoo to Mr. Satan
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:10.


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