Raised This Month: $ Target: $400
 0% 

Red Nightvision?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yikomaka
Member
Join Date: May 2004
Old 09-11-2004 , 22:07   Red Nightvision?
Reply With Quote #1

Okay heres the code... when I type amx_nvg in the game console it does not fade red or anything..... help? Thanks

Code:
#include <amxmodx>
public plugin_init() {
	register_plugin("Red NVG","1.0","SnipaJ")
	register_clcmd("amx_nvg","nvg1")
	register_clcmd("amx_nvg2","nvg2")
	register_clcmd("amx_nvg3","nvg3")
}

public nvg1(id) {
    message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
    write_short( 1<<99999) // fade lasts this long duration
    write_short( 1<<99999 ) // fade lasts this long hold time
    write_short( 1<<12 ) // fade type (in / out)
    write_byte( 200 ) // fade red
    write_byte( 0 ) // fade green
    write_byte( 0 ) // fade blue
    write_byte( 50 ) // fade alpha
    message_end()
    return PLUGIN_HANDLED
}

public nvg2(id) {
    message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
    write_short( 1<<99999) // fade lasts this long duration
    write_short( 1<<99999 ) // fade lasts this long hold time
    write_short( 1<<12 ) // fade type (in / out)
    write_byte( 200 ) // fade red
    write_byte( 0 ) // fade green
    write_byte( 0 ) // fade blue
    write_byte( 150 ) // fade alpha
    message_end()
    return PLUGIN_HANDLED
}

public nvg3(id) {
    message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
    write_short( 1<<99999) // fade lasts this long duration
    write_short( 1<<99999 ) // fade lasts this long hold time
    write_short( 1<<12 ) // fade type (in / out)
    write_byte( 200 ) // fade red
    write_byte( 0 ) // fade green
    write_byte( 0 ) // fade blue
    write_byte( 200 ) // fade alpha
    message_end()
    return PLUGIN_HANDLED
}
yikomaka is offline
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-12-2004 , 00:10  
Reply With Quote #2

1 << # is bitwise manipulation.

The bits are shorts, 16 bit.

So, this is what you're doing:

Take short "0000 0000 0000 0001" and leftshift it by 99999 bits

the result:

"0000 0000 0000 0000"


That doesn't seem very long to me!


To get 'maximum length' simply do ~0 instead of 1 << 99999

~1 (which is Not "0000 0000 0000 0000") will make it "1111 1111 1111 1111"


Unless it's signed. In which case you want ~1<<15.
Anpheus is offline
johnjg75
Veteran Member
Join Date: Mar 2004
Location: Delaware
Old 09-12-2004 , 00:11  
Reply With Quote #3

could we change write_short() to write_long() ?
__________________
johnjg75 is offline
Send a message via AIM to johnjg75 Send a message via MSN to johnjg75 Send a message via Yahoo to johnjg75
Anpheus
Senior Member
Join Date: Aug 2004
Old 09-12-2004 , 00:13  
Reply With Quote #4

Possibly, I don't know how the message works. It's equally probably you'd crash the game.
Anpheus is offline
johnjg75
Veteran Member
Join Date: Mar 2004
Location: Delaware
Old 09-12-2004 , 00:24  
Reply With Quote #5

Fixed!
__________________
johnjg75 is offline
Send a message via AIM to johnjg75 Send a message via MSN to johnjg75 Send a message via Yahoo to johnjg75
Ares0016
Junior Member
Join Date: Jan 2005
Old 03-23-2005 , 19:38   Can some one give me the final copy
Reply With Quote #6

could some one make it so if u type amx_nvg (color)
it will give u that color
Ares0016 is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-24-2005 , 02:06  
Reply With Quote #7

Code:
message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, id) write_byte(27) // TE_DLIGHT write_coord(origin[0]) // X coord write_coord(origin[1]) // Y coord write_coord(origin[2]) // Z coord write_coord(radius) // radius write_byte(250) // red write_byte(0) // green write_byte(0) // blue write_byte(250) // brightness write_byte(10) // life write_coord(0) // decay rate message_end()
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Reply


Thread Tools
Display Modes

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 17:16.


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