AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NVG Color (https://forums.alliedmods.net/showthread.php?t=10804)

v3x 03-01-2005 13:42

NVG Color
 
Hey, is there a way I can change the color of NVG (nightvision goggles) to say, red?

Code:
public setNvg(index) {     cs_set_user_nvg(index,1)     // Set nvg color ... }

Extremeone 03-01-2005 14:11

in the superhero forums the terminator hero has red NVG i think its somewhere in here:
Code:
public ToggleNVG(id) {    if (!gHasTermPower[id] || !shModActive() ) return PLUGIN_CONTINUE    if (NightVisionUse[id]) StopNVG(id)    else StartNVG(id)    return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- public StartNVG(id) // NightVision code by Lazy (a little bit modified) {    if ( !gHasTermPower[id] || !shModActive() ) return PLUGIN_CONTINUE    new player[32]    get_user_name(id,player,32)    emit_sound(id,CHAN_ITEM,"items/nvg_on.wav",1.0,ATTN_NORM,0,PITCH_NORM)    set_task(0.1,"RunNVG",id+100,player,32,"b") // another task id for each player    set_task(0.1,"RunNVG2",id+200,player,32,"b")    NightVisionUse[id] = true    return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- public StopNVG(id) {    emit_sound(id,CHAN_ITEM,"items/nvg_off.wav",1.0,ATTN_NORM,0,PITCH_NORM)    remove_task(id+100)    remove_task(id+200)    NightVisionUse[id] = false    return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- public RunNVG(player[]) {    new id = get_user_index(player)    new origin[3]    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(230)    write_byte(0)    write_byte(0)    write_byte(1)    write_byte(10)    message_end() } //---------------------------------------------------------------------------------------------- public RunNVG2(player[]) {    new id = get_user_index(player)    message_begin(MSG_ONE,gmsgFade,{0,0,0},id)    write_short(1000)    write_short(1000)    write_short(1<<12)    write_byte(230)    write_byte(0)    write_byte(0)    write_byte(150)    message_end() } //----------------------------------------------------------------------------------------------


you can dl the full source here:
http://shero.rocks-hideout.com/forum...load.php?id=34

edit

or here?
Code:
new bool:NightVisionUse[33]

v3x 03-01-2005 14:20

NightVisionUse is set when it's in use, so you can't use it while your using it :P. Note the NightVisionUse[id] = true code.

I guess what I'm looking for is in all of that write crap that I don't understand :(.

knekter 03-01-2005 17:18

simple
 
He isnt changing the color of the NVG, hes using a message:

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()

TE_DLIGHT stands for Temporary Entity Dynamic Light

v3x 03-01-2005 17:29

So that is all I need?


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

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