Plug-ins compatibility with Zombie Escape 1.x only!
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#1
Post
by Mark » 5 years ago
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:
Last edited by
Raheem 4 years ago, edited 1 time in total.
Reason: Updated with right Send_Cmd loop
-
Rain1153
- Senior Member
- Posts: 278
- Joined: 6 years ago
-
Contact:
-
Quote
-
0
login to like this post
#3
Post
by Rain1153 » 5 years ago
Read the description
LOL
-
tmv
- Member
- Posts: 36
- Joined: 4 years ago
-
Contact:
-
Quote
-
0
login to like this post
#5
Post
by tmv » 4 years ago
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
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#6
Post
by Raheem » 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()
}
He who fails to plan is planning to fail
-
tmv
- Member
- Posts: 36
- Joined: 4 years ago
-
Contact:
-
Quote
-
0
login to like this post
#7
Post
by tmv » 4 years ago
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?
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#8
Post
by Raheem » 4 years ago
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.
He who fails to plan is planning to fail
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#9
Post
by Mark » 4 years ago
Whoops Sorry!
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
Users browsing this forum: No registered users and 2 guests