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