While browsing a Russian amxmodx forum I came across an interesting MOTD plugin. I tried to install it and amx_plugins showed it as "running" but there was no new custom MOTD.
Link to the forum;
https://dev-cs.ru/resources/951/extra
Link to Youtube demo;
https://youtu.be/JGHORmZ_CvU
Is it possible to edit the code to work without reapi? The originator replied to someone who had asked the question and said nyet.
My server is running amxx ver 1.9.0.5294
motd_model
#pragma semicolon 1
#include <amxmodx>
#include <reapi>
#define MAX_PLAYERS 32
new const MOTD_MODEL[] = "models/nezhno_inf.mdl";
enum IntroState
{
INTRO_INIT,
INTRO_PLAYING,
INTRO_END,
}; new IntroState:g_iIntroState[MAX_PLAYERS + 1];
new motdmdl_skippable_intro;
public plugin_precache()
{
register_plugin("MOTD Model", "1.1.0", "fl0wer");
precache_model(MOTD_MODEL);
}
public plugin_init()
{
RegisterHookChain(RG_ShowVGUIMenu, "@ShowVGUIMenu_Pre", false);
RegisterHookChain(RG_HandleMenu_ChooseTeam, "@HandleMenu_ChooseTeam_Pre", false);
bind_pcvar_num(create_cvar("motdmdl_skippable _intro", "0", _, "Players can skip intro by menu keys^n0 - disabled^n1 - enabled", true, 0.0, true, 1.0), motdmdl_skippable_intro);
}
public client_putinserver(id)
{
g_iIntroState[id] = is_user_bot(id) ? INTRO_END : INTRO_INIT;
}
@ShowVGUIMenu_Pre(id, VGUIMenu:menuType, bitsSlots, oldMenu[])
{
if (menuType != VGUI_Menu_Team)
return;
if (g_iIntroState[id] == INTRO_END)
return;
if (get_member(id, m_iJoiningState) == JOINED)
return;
if (g_iIntroState[id] == INTRO_INIT)
{
g_iIntroState[id] = INTRO_PLAYING;
set_entvar(id, var_viewmodel, MOTD_MODEL);
set_task(3.65, "@Task_IntroEnd", id);
}
set_member(id, m_bForceShowMenu, true);
SetHookChainArg(3, ATYPE_INTEGER, 1023);
SetHookChainArg(4, ATYPE_STRING, "\n");
}
@HandleMenu_ChooseTeam_Pre(id, key)
{
if (g_iIntroState[id] == INTRO_END)
return HC_CONTINUE;
if (g_iIntroState[id] == INTRO_PLAYING && motdmdl_skippable_intro)
StopIntro(id);
SetHookChainReturn(ATYPE_INTEGER, false);
return HC_SUPERCEDE;
}
@Task_IntroEnd(task)
{
new id = task;
if (!is_user_connected(id))
return;
StopIntro(id);
}
StopIntro(id)
{
remove_task(id);
g_iIntroState[id] = INTRO_END;
set_entvar(id, var_viewmodel, "");
engclient_cmd(id, "menuselect", "0");
}