Available Midnight's Darkness

Unpaid Requests, Public Plugins
Post Reply
Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

Midnight's Darkness

#1

Post by Rain1153 » 6 years ago

I'm just asking! will it be useful + fun in our mod?
Since zombies have nightvision they can hunt more at night humans have to survive the night.
A round will be night round (random round) Round set by cvars. lighting system can be linked with ze.cfg with the plugin i guess.
original plugin link : https://forums.alliedmods.net/showthread.php?t=212740.
In my opinion we must give it a try :D
~i'm just a noob :(
LOL

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 6 years ago

Hmm, I do something like: I try to detect how many number of rounds will be in one map by dividing maptime/roundtime this give me min rounds can be played. Then i get random number between 0 round and this number i get. The random round will be darkness and it's only 1 round per map.

Or better idea is to get map time and get random number between 0 - maptime and then start darkness for a period that we define by cvar? I don't know but this what i did: Don't forget to change default light from code.
He who fails to plan is planning to fail

Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

#3

Post by Rain1153 » 6 years ago

Ok
Last edited by Rain1153 6 years ago, edited 1 time in total.
LOL

Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

#4

Post by Rain1153 » 6 years ago

Raheem it's not random it starts in the first round itself! But i want it to start at random rounds .or if it cant be random can we set the exact rounds which night mode will start by
making g_iRoundNum = 0 to any numbers?
If yes i tried it at 3 but night mode never started!
LOL

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#5

Post by Raheem » 6 years ago

Try something like: g_iRandomRoundNum = random_num(0, 10) But if in your server in one map you don't play 10 rounds so it won't be appear the darkness round.
He who fails to plan is planning to fail

Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

#6

Post by Rain1153 » 6 years ago

Yeah thanks it's working now :)
LOL

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#7

Post by Mark » 5 years ago

Rain1153 wrote: 6 years ago Yeah thanks it's working now :)
I edit this to remove Fog if you have fog on. It will become total backout!
  1. #include <zombie_escape>
  2.  
  3. #define DARKSOUND "dark/darkness.wav"
  4. #define DEFAULT_LIGHT "d"
  5.  
  6. new g_pCvarRoundTime, g_pCvarMapTime, g_iRandomRoundNum, g_iRoundNum, bool:g_bDarkRoundCome
  7.  
  8. public plugin_init()
  9. {
  10.     register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
  11.    
  12.     // Pointers
  13.     g_pCvarRoundTime = get_cvar_pointer("mp_roundtime")
  14.     g_pCvarMapTime = get_cvar_pointer("mp_timelimit")
  15.    
  16.     // Check rounds number
  17.     new iRoundsNumber = get_pcvar_num(g_pCvarMapTime) / get_pcvar_num(g_pCvarRoundTime)
  18.    
  19.     // Get random round
  20.     g_iRandomRoundNum = random_num(0, iRoundsNumber)
  21.    
  22.     // Set counter to 0 first round
  23.     g_iRoundNum = 0
  24.    
  25.     // Dark round false
  26.     g_bDarkRoundCome = false
  27. }
  28.  
  29. public plugin_precache()
  30. {
  31.     precache_sound(DARKSOUND)
  32. }
  33.  
  34. public ze_game_started()
  35. {
  36.     if (g_iRoundNum == g_iRandomRoundNum)
  37.     {
  38.         for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
  39.         {
  40.             if (!is_user_connected(id))
  41.                 continue
  42.            
  43.             PlaySound(id, DARKSOUND)
  44.         }
  45.  
  46.         server_cmd("ze_lighting_style a")
  47.         client_cmd(0, "gl_fog 0")
  48.         g_bDarkRoundCome = true
  49.         ze_colored_print(0, "!tIt's too late... Darkness round is ON!y!")
  50.     }
  51.    
  52.     g_iRoundNum++
  53. }
  54.  
  55. public ze_roundend(WinTeam)
  56. {
  57.     if (g_bDarkRoundCome == true)
  58.     {
  59.         server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
  60.         client_cmd(0, "gl_fog 1")
  61.         g_bDarkRoundCome = false
  62.     }
  63. }

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#8

Post by Mark » 5 years ago

Raheem wrote: 6 years ago Hmm, I do something like: I try to detect how many number of rounds will be in one map by dividing maptime/roundtime this give me min rounds can be played. Then i get random number between 0 round and this number i get. The random round will be darkness and it's only 1 round per map.

Or better idea is to get map time and get random number between 0 - maptime and then start darkness for a period that we define by cvar? I don't know but this what i did:
  • Darness Round.zip
Don't forget to change default light from code.
Can you add this to addons so its not hard to find lol

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#9

Post by Raheem » 5 years ago

Mark wrote: 5 years ago
Rain1153 wrote: 6 years ago Yeah thanks it's working now :)
I edit this to remove Fog if you have fog on. It will become total backout!
  1. #include <zombie_escape>
  2.  
  3. #define DARKSOUND "dark/darkness.wav"
  4. #define DEFAULT_LIGHT "d"
  5.  
  6. new g_pCvarRoundTime, g_pCvarMapTime, g_iRandomRoundNum, g_iRoundNum, bool:g_bDarkRoundCome
  7.  
  8. public plugin_init()
  9. {
  10.     register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
  11.    
  12.     // Pointers
  13.     g_pCvarRoundTime = get_cvar_pointer("mp_roundtime")
  14.     g_pCvarMapTime = get_cvar_pointer("mp_timelimit")
  15.    
  16.     // Check rounds number
  17.     new iRoundsNumber = get_pcvar_num(g_pCvarMapTime) / get_pcvar_num(g_pCvarRoundTime)
  18.    
  19.     // Get random round
  20.     g_iRandomRoundNum = random_num(0, iRoundsNumber)
  21.    
  22.     // Set counter to 0 first round
  23.     g_iRoundNum = 0
  24.    
  25.     // Dark round false
  26.     g_bDarkRoundCome = false
  27. }
  28.  
  29. public plugin_precache()
  30. {
  31.     precache_sound(DARKSOUND)
  32. }
  33.  
  34. public ze_game_started()
  35. {
  36.     if (g_iRoundNum == g_iRandomRoundNum)
  37.     {
  38.         for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
  39.         {
  40.             if (!is_user_connected(id))
  41.                 continue
  42.            
  43.             PlaySound(id, DARKSOUND)
  44.         }
  45.  
  46.         server_cmd("ze_lighting_style a")
  47.         client_cmd(0, "gl_fog 0")
  48.         g_bDarkRoundCome = true
  49.         ze_colored_print(0, "!tIt's too late... Darkness round is ON!y!")
  50.     }
  51.    
  52.     g_iRoundNum++
  53. }
  54.  
  55. public ze_roundend(WinTeam)
  56. {
  57.     if (g_bDarkRoundCome == true)
  58.     {
  59.         server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
  60.         client_cmd(0, "gl_fog 1")
  61.         g_bDarkRoundCome = false
  62.     }
  63. }
For better slow hacking:
    1. #include <zombie_escape>
    2.  
    3. #define DARKSOUND "dark/darkness.wav"
    4. #define DEFAULT_LIGHT "d"
    5.  
    6. new g_pCvarRoundTime, g_pCvarMapTime, g_iRandomRoundNum, g_iRoundNum, bool:g_bDarkRoundCome
    7.  
    8. public plugin_init()
    9. {
    10.     register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
    11.    
    12.     // Pointers
    13.     g_pCvarRoundTime = get_cvar_pointer("mp_roundtime")
    14.     g_pCvarMapTime = get_cvar_pointer("mp_timelimit")
    15.    
    16.     // Check rounds number
    17.     new iRoundsNumber = get_pcvar_num(g_pCvarMapTime) / get_pcvar_num(g_pCvarRoundTime)
    18.    
    19.     // Get random round
    20.     g_iRandomRoundNum = random_num(0, iRoundsNumber)
    21.    
    22.     // Set counter to 0 first round
    23.     g_iRoundNum = 0
    24.    
    25.     // Dark round false
    26.     g_bDarkRoundCome = false
    27. }
    28.  
    29. public plugin_precache()
    30. {
    31.     precache_sound(DARKSOUND)
    32. }
    33.  
    34. public ze_game_started()
    35. {
    36.     if (g_iRoundNum == g_iRandomRoundNum)
    37.     {
    38.         for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
    39.         {
    40.             if (!is_user_connected(id))
    41.                 continue
    42.            
    43.             PlaySound(id, DARKSOUND)
    44.         }
    45.  
    46.         server_cmd("ze_lighting_style a")
    47.         client_cmd(0, "gl_fog 0")
    48.         g_bDarkRoundCome = true
    49.         ze_colored_print(0, "!tIt's too late... Darkness round is ON!y!")
    50.     }
    51.    
    52.     g_iRoundNum++
    53. }
    54.  
    55. public ze_roundend(WinTeam)
    56. {
    57.     if (g_bDarkRoundCome == true)
    58.     {
    59.         server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
    60.         Send_Cmd(0, "gl_fog 1")
    61.         g_bDarkRoundCome = false
    62.     }
    63. }
    64.  
    65. stock Send_Cmd(id, text[])
    66. {
    67.     message_begin(MSG_ONE, 51, _, id)
    68.     write_byte(strlen(text) + 2)
    69.     write_byte(10)
    70.     write_string(text)
    71.     message_end()
    72. }
Also i give you rights to publish it instead of me, i'm just lazy to do it.
He who fails to plan is planning to fail

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 4 guests