So i created a plugin that whenever the server restarts ( sv_restart ) to kill all the players alive
But it happened that i noticed that sometimes things are getting a little crazy
If the server restart happens during the round end event, it has some crazy outcomes
On stock HLDS/GameDLL running AMXX 1.8.3 ( probably happens and on 1.8.2 )
- The server gets stuck in a round ending loop
On ReHLDS/ReGame running AMXX 1.8.3 ( probably happens and on 1.8.2 )
- Both the client and the server are crashing
Now i'm no genius, but in the first case, the round end should not be called again, if it is already ended.. and in the second case i have no idea..
Steps to reproduce
Code:
Version 1
Join the game
set mp_roundtime to 1
set mp_freezetime to 0
set sv_restart to 1
Now you will either get stuck in a round end loop / in case of ReHLDS + ReGame it will either loop or crash
Version 2
set mp_roundtime to 1 ( from .cfg file )
set mp_freezetime to 0 ( from .cfg file )
Join the game
Wait for the round to end
Now both the client and the server shall crash
Now you will get stuck in a round end loop, in case of ReHLDS +ReGame it will crash
Builds Used
Code:
REHLDS : 1291
REGAME : 5.3.0.270 dev
AMXMODX : 5144 dev
OS: Windows 10 & Linux
Test Code
PHP Code:
public plugin_init()
{
register_plugin("Plugin Test", "1.0", "Depresie")
register_logevent("logevent_round_end", 2, "1=Round_End")
register_message(get_user_msgid("TextMsg"), "hook_message_text")
}
public logevent_round_end()
{
server_cmd("sv_restart 1")
}
public hook_message_text(iMessage, iDest, iPlayer)
{
new szMessage[32]
get_msg_arg_string(2, szMessage, charsmax(szMessage))
// Handle Server Restart
if(equal(szMessage, "#Game_will_restart_in"))
{
kill_alive_players()
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public kill_alive_players()
{
client_print(0, print_chat, "called")
new iPlayers[32], iNum
get_players(iPlayers, iNum, "ch")
for(new i = 0; i < iNum; i++)
{
new iPlayer = iPlayers[i]
if(is_user_alive(iPlayer))
{
user_silentkill(iPlayer)
}
}
}
__________________