Quote:
Originally Posted by eLLectro
Hello! I have this bio_nightvision_final plugin for the biohazard mode that I want to use together with the thermal_goggles plugin, so that zombies can see people through walls when they are infected, But I have a problem, this nightvision is always ON and does not turn off if you press N so as it should be, I tried to use thermal_googles with other nightvisions but it only works with this one, Can someone combine these two ways? to go close when you press N because it is always on
|
Can you add this into your bio_nightvision
PHP Code:
// Nightvision toggle
public clcmd_nightvision(id)
{
// Toggle night vision
g_nvision[id] = !g_nvision[id];
// Custom nvg?
if (get_pcvar_num(cvar_cnvg))
{
remove_task(id + TASK_NVISION);
if (g_nvision[id])
set_task(0.1, "set_user_nvision", id + TASK_NVISION, _, _, "b");
else
set_task(0.1, "remove_user_nvision", id + TASK_NVISION, _, _, "b");
}
else
{
set_user_gnvision(id, g_nvision[id]);
}
return PLUGIN_HANDLED;
}
// Remove Nightvision
public remove_user_nvision(taskid)
{
// Not meant to have nvision
if (!g_nvision[ID_NVISION] || !is_user_alive(ID_NVISION))
{
// Task not needed anymore
remove_task(taskid);
return;
}
// Turn off Night Vision
set_user_gnvision(ID_NVISION, 0);
}
__________________