Raised This Month: $51 Target: $400
 12% 

Solved Request Light plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 04-13-2018 , 16:20   Request Light plugin
Reply With Quote #1

Hello i request a light plugin.. i was thinking about round time lights.. set by cvar at every minute passed it get's darker and darker.. and hud messaged by night is fallen and sounds.. let me explained how i thinked..

Ex:
i put 8 Min of Roundtime.
at 8->7 min it's the lightest. Light level: c
at 7->4 min a little darker. Light level: b
at 4->0 min it's dark. Light level: a

Hud message at 7 min : It's day time..
Hud message at 5 min : It's time to prepare your nightvision and flashlight
Hud message at 4 min : It's dark now

sounds use when it light automatically change ii prefer to use external sounds.
ex: wolfhowl01.wav and wolfhowl02.wav

Note: The round time and lights level i wanna need to set by cvar.

After round ends it's reset the lights and do it again at the new round starts
i use for classic game mode. No Zombie Plague
Thank you!

Last edited by eNNkds; 04-15-2018 at 18:16.
eNNkds is offline
Send a message via Skype™ to eNNkds
CookieCrumbler
Senior Member
Join Date: Feb 2013
Location: Australia
Old 04-14-2018 , 01:47   Re: Request Light plugin
Reply With Quote #2

Install a plugin called amx_lights https://forums.alliedmods.net/showthread.php?t=3395 , to use in conjunction with this



PHP Code:
#include <amxmodx>
#include <amxmisc>

#define TASK_LIGHTS1   1000
#define TASK_LIGHTS2   1001
#define TASK_LIGHTS3   1002

new const g_szSndWolf1[] = "wolf/wolf1.mp3";
new const 
g_szSndWolf2[] = "wolf/wolf2.mp3";

public 
plugin_precache()
{
    
precache_soundg_szSndWolf1 );
    
precache_soundg_szSndWolf2 );
}

public 
plugin_init()
{
    
register_plugin("Night Wolf""0.1""AUTHOR")
    
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
}

public 
Event_HLTV_New_Round()
{
    
server_cmd("amx_lights m")
    
remove_task(TASK_LIGHTS1)
    
remove_task(TASK_LIGHTS2)
    
remove_task(TASK_LIGHTS3)
    
set_task(60.0"light_phase_one"TASK_LIGHTS1)
    
set_task(240.0"light_phase_msg"TASK_LIGHTS2)
    
set_task(300.0"light_phase_two"TASK_LIGHTS2)
}

public 
light_phase_one()
{
    
server_cmd("amx_lights g")
    
set_hudmessage(02550, -1.00.0012.010.0)
    
show_hudmessage(0"It's Day Time !!"
    
    return 
PLUGIN_CONTINUE
}
public 
light_phase_msg()
{
    
set_hudmessage(02550, -1.00.0012.010.0)
    
show_hudmessage(0"It's time to prepare your nightvision and flashlight !!"
    
client_cmd0"mp3 play sound/%s"g_szSndWolf1 );
    
    return 
PLUGIN_CONTINUE
}    
public 
light_phase_two()
{
    
server_cmd("amx_lights a")
    
set_hudmessage(02550, -1.00.0012.010.0)
    
show_hudmessage(0"It's dark now !!")
    
client_cmd0"mp3 play sound/%s"g_szSndWolf2 );
    
    return 
PLUGIN_CONTINUE

__________________
--------------------------------------------------
C is for cookie ... thats good enuff 4 me
CookieCrumbler is offline
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 04-14-2018 , 04:36   Re: Request Light plugin
Reply With Quote #3

thank you very much! i love it. how i set the hud message to add more +2 seconds to show?
eNNkds is offline
Send a message via Skype™ to eNNkds
sekac
Senior Member
Join Date: Nov 2016
Old 04-14-2018 , 15:21   Re: Request Light plugin
Reply With Quote #4

Quote:
Originally Posted by eNNkds View Post
thank you very much! i love it. how i set the hud message to add more +2 seconds to show?
Try this, also you don't need amx_lights plugin.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define TASK_LIGHTS1   1000
#define TASK_LIGHTS2   1001
#define TASK_LIGHTS3   1002

#define NORMAL 0
#define DAY 1
#define NOON 2
#define NIGHT 3


new const g_szSndWolf1[] = "wolf/wolf1.mp3"
new const g_szSndWolf2[] = "wolf/wolf2.mp3"

new phase

public plugin_precache()
{
    
precache_sound(g_szSndWolf1)
    
precache_sound(g_szSndWolf2)
}

public 
plugin_init()
{
    
register_plugin("Night Wolf""0.1""AUTHOR")
    
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
}

public 
Event_HLTV_New_Round()
{
    
set_lights("m")
    
phase NORMAL
    remove_task
(TASK_LIGHTS1)
    
remove_task(TASK_LIGHTS2)
    
remove_task(TASK_LIGHTS3)
    
set_task(60.0"light_phase_day"TASK_LIGHTS1)
    
set_task(240.0"light_phase_noon"TASK_LIGHTS2)
    
set_task(300.0"light_phase_night"TASK_LIGHTS2)
}

public 
client_putinserver(id)
{
    switch(
phase) {
        case 
DAYset_lights("c")
        case 
NOONset_lights("b")
        case 
NIGHTset_lights("a")
        default: 
set_lights("m")
    }
}

public 
light_phase_day()
{
    
set_lights("c")
    
phase DAY
    set_hudmessage
(02550, -1.00.0012.012.0)
    
show_hudmessage(0"It's day time!"
    
    return 
PLUGIN_CONTINUE
}
public 
light_phase_noon()
{
    
set_lights("b")
    
phase NOON
    set_hudmessage
(02550, -1.00.0012.012.0)
    
show_hudmessage(0"It's time to prepare your nightvision and flashlight!"
    
client_cmd(0"mp3 play sound/%s"g_szSndWolf1)
    
    return 
PLUGIN_CONTINUE
}    
public 
light_phase_night()
{
    
set_lights("a")
    
phase NIGHT
    set_hudmessage
(02550, -1.00.0012.012.0)
    
show_hudmessage(0"It's dark now!")
    
client_cmd(0"mp3 play sound/%s"g_szSndWolf2)
    
    return 
PLUGIN_CONTINUE


Last edited by sekac; 04-14-2018 at 15:38. Reason: Updated
sekac is offline
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 04-15-2018 , 06:27   Re: Request Light plugin
Reply With Quote #5

it's work sekac thank you. i noticed the hud massege appears and don't stay like 2-3 seconds on hud
eNNkds is offline
Send a message via Skype™ to eNNkds
CookieCrumbler
Senior Member
Join Date: Feb 2013
Location: Australia
Old 04-15-2018 , 06:37   Re: Request Light plugin
Reply With Quote #6

https://www.amxmodx.org/api/amxmodx/set_hudmessage

This has the instructions for all the variables for set_hudmessage
__________________
--------------------------------------------------
C is for cookie ... thats good enuff 4 me
CookieCrumbler is offline
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 11:38.


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