Page 1 of 1
Darkness Round
Posted: 15 Sep 2018, 23:01
by Mark
Darkness Round
Description:
- This will set dark rounds randomly as the new round starts
- It will also remove the fog while in this round
Credits:
Code:
#include <zombie_escape>
#define DARKSOUND "dark/darkness.wav"
#define DEFAULT_LIGHT "d"
new g_pCvarRoundTime, g_pCvarMapTime, g_iRandomRoundNum, g_iRoundNum, bool:g_bDarkRoundCome
new g_iMaxPlayers
public plugin_init()
{
register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
// Pointers
g_pCvarRoundTime = get_cvar_pointer("mp_roundtime")
g_pCvarMapTime = get_cvar_pointer("mp_timelimit")
// Check rounds number
new iRoundsNumber = get_pcvar_num(g_pCvarMapTime) / get_pcvar_num(g_pCvarRoundTime)
// Get random round
g_iRandomRoundNum = random_num(0, iRoundsNumber)
// Set counter to 0 first round
g_iRoundNum = 0
// Dark round false
g_bDarkRoundCome = false
g_iMaxPlayers = get_member_game(m_nMaxPlayers)
}
public plugin_precache()
{
precache_sound(DARKSOUND)
}
public ze_game_started()
{
if (g_iRoundNum == g_iRandomRoundNum)
{
for (new id = 1; id <= g_iMaxPlayers; id++)
{
if (!is_user_connected(id))
continue
PlaySound(id, DARKSOUND)
Send_Cmd(id, "gl_fog 0")
}
server_cmd("ze_lighting_style a")
g_bDarkRoundCome = true
ze_colored_print(0, "!tIt's too late... Darkness round is ON!y!")
}
g_iRoundNum++
}
public ze_roundend(WinTeam)
{
if (g_bDarkRoundCome == true)
{
server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
for (new id = 1; id <= g_iMaxPlayers; id++)
{
if (!is_user_connected(id))
continue
Send_Cmd(id, "gl_fog 1")
}
g_bDarkRoundCome = false
}
}
stock Send_Cmd(id, text[])
{
message_begin(MSG_ONE, 51, _, id)
write_byte(strlen(text) + 2)
write_byte(10)
write_string(text)
message_end()
}
If your want fog to be off use this code:
#include <zombie_escape>
#define DARKSOUND "dark/darkness.wav"
#define DEFAULT_LIGHT "d"
new g_pCvarRoundTime, g_pCvarMapTime, g_iRandomRoundNum, g_iRoundNum, bool:g_bDarkRoundCome
public plugin_init()
{
register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
// Pointers
g_pCvarRoundTime = get_cvar_pointer("mp_roundtime")
g_pCvarMapTime = get_cvar_pointer("mp_timelimit")
// Check rounds number
new iRoundsNumber = get_pcvar_num(g_pCvarMapTime) / get_pcvar_num(g_pCvarRoundTime)
// Get random round
g_iRandomRoundNum = random_num(0, iRoundsNumber)
// Set counter to 0 first round
g_iRoundNum = 0
// Dark round false
g_bDarkRoundCome = false
}
public plugin_precache()
{
precache_sound(DARKSOUND)
}
public ze_game_started()
{
if (g_iRoundNum == g_iRandomRoundNum)
{
for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
{
if (!is_user_connected(id))
continue
PlaySound(id, DARKSOUND)
}
server_cmd("ze_lighting_style a")
g_bDarkRoundCome = true
ze_colored_print(0, "!tIt's too late... Darkness round is ON!y!")
}
g_iRoundNum++
}
public ze_roundend(WinTeam)
{
if (g_bDarkRoundCome == true)
{
server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
g_bDarkRoundCome = false
}
}
stock Send_Cmd(id, text[])
{
message_begin(MSG_ONE, 51, _, id)
write_byte(strlen(text) + 2)
write_byte(10)
write_string(text)
message_end()
}
Download:
Re: Darkness Round
Posted: 19 Jan 2019, 17:34
by Muhammet20
what is this can do ?
Re: Darkness Round
Posted: 20 Jan 2019, 06:25
by Rain1153
Read the description
Re: Darkness Round
Posted: 21 Jan 2019, 11:56
by Muhammet20
Rain1153 wrote: ↑5 years ago
Read the description
good idea but i dont need it
Re: Darkness Round
Posted: 28 Jul 2019, 08:56
by tmv
First code's fog doesn't work and the server crashes because of this error:
Code: Select all
Host_Error: WriteDest_Parm: not a client
Re: Darkness Round
Posted: 28 Jul 2019, 22:26
by Raheem
Please give a try:
#include <zombie_escape>
#define DARKSOUND "dark/darkness.wav"
#define DEFAULT_LIGHT "d"
new g_pCvarRoundTime, g_pCvarMapTime, g_iRandomRoundNum, g_iRoundNum, bool:g_bDarkRoundCome
new g_iMaxPlayers
public plugin_init()
{
register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
// Pointers
g_pCvarRoundTime = get_cvar_pointer("mp_roundtime")
g_pCvarMapTime = get_cvar_pointer("mp_timelimit")
// Check rounds number
new iRoundsNumber = get_pcvar_num(g_pCvarMapTime) / get_pcvar_num(g_pCvarRoundTime)
// Get random round
g_iRandomRoundNum = random_num(0, iRoundsNumber)
// Set counter to 0 first round
g_iRoundNum = 0
// Dark round false
g_bDarkRoundCome = false
g_iMaxPlayers = get_member_game(m_nMaxPlayers)
}
public plugin_precache()
{
precache_sound(DARKSOUND)
}
public ze_game_started()
{
if (g_iRoundNum == g_iRandomRoundNum)
{
for (new id = 1; id <= g_iMaxPlayers; id++)
{
if (!is_user_connected(id))
continue
PlaySound(id, DARKSOUND)
Send_Cmd(id, "gl_fog 0")
}
server_cmd("ze_lighting_style a")
g_bDarkRoundCome = true
ze_colored_print(0, "!tIt's too late... Darkness round is ON!y!")
}
g_iRoundNum++
}
public ze_roundend(WinTeam)
{
if (g_bDarkRoundCome == true)
{
server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
for (new id = 1; id <= g_iMaxPlayers; id++)
{
if (!is_user_connected(id))
continue
Send_Cmd(id, "gl_fog 1")
}
g_bDarkRoundCome = false
}
}
stock Send_Cmd(id, text[])
{
message_begin(MSG_ONE, 51, _, id)
write_byte(strlen(text) + 2)
write_byte(10)
write_string(text)
message_end()
}
Re: Darkness Round
Posted: 29 Jul 2019, 08:06
by tmv
Raheem wrote: ↑4 years ago
Please give a try:
#include <zombie_escape>
#define DARKSOUND "dark/darkness.wav"
#define DEFAULT_LIGHT "d"
new g_pCvarRoundTime, g_pCvarMapTime, g_iRandomRoundNum, g_iRoundNum, bool:g_bDarkRoundCome
new g_iMaxPlayers
public plugin_init()
{
register_plugin("[ZE] Darkness Round", "1.0", "Raheem")
// Pointers
g_pCvarRoundTime = get_cvar_pointer("mp_roundtime")
g_pCvarMapTime = get_cvar_pointer("mp_timelimit")
// Check rounds number
new iRoundsNumber = get_pcvar_num(g_pCvarMapTime) / get_pcvar_num(g_pCvarRoundTime)
// Get random round
g_iRandomRoundNum = random_num(0, iRoundsNumber)
// Set counter to 0 first round
g_iRoundNum = 0
// Dark round false
g_bDarkRoundCome = false
g_iMaxPlayers = get_member_game(m_nMaxPlayers)
}
public plugin_precache()
{
precache_sound(DARKSOUND)
}
public ze_game_started()
{
if (g_iRoundNum == g_iRandomRoundNum)
{
for (new id = 1; id <= g_iMaxPlayers; id++)
{
if (!is_user_connected(id))
continue
PlaySound(id, DARKSOUND)
Send_Cmd(id, "gl_fog 0")
}
server_cmd("ze_lighting_style a")
g_bDarkRoundCome = true
ze_colored_print(0, "!tIt's too late... Darkness round is ON!y!")
}
g_iRoundNum++
}
public ze_roundend(WinTeam)
{
if (g_bDarkRoundCome == true)
{
server_cmd("ze_lighting_style %s", DEFAULT_LIGHT)
for (new id = 1; id <= g_iMaxPlayers; id++)
{
if (!is_user_connected(id))
continue
Send_Cmd(id, "gl_fog 1")
}
g_bDarkRoundCome = false
}
}
stock Send_Cmd(id, text[])
{
message_begin(MSG_ONE, 51, _, id)
write_byte(strlen(text) + 2)
write_byte(10)
write_string(text)
message_end()
}
This is Okay. Is this the same problem as Previous post when (if is_user_connected) was not defined?
Re: Darkness Round
Posted: 30 Jul 2019, 12:36
by Raheem
No, he was sending a message to all user using message_begin(MSG_ONE, 51, _, 0)
and this not secured as it gives you an error, so the right is we loop through all players and send the message for every player with message_begin(MSG_ONE, 51, _, id)
.
Anyway not know how [mention]Mark[/mention] posted this, he maybe not tested it. I updated the main code.
Re: Darkness Round
Posted: 10 Nov 2019, 00:01
by Mark
Whoops Sorry!