Raised This Month: $51 Target: $400
 12% 

MOTD_Model Replaces default MOTD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kirksite
Member
Join Date: Feb 2021
Old 01-06-2023 , 02:10   MOTD_Model Replaces default MOTD
Reply With Quote #1

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");
}
kirksite is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-07-2023 , 00:10   Re: MOTD_Model Replaces default MOTD
Reply With Quote #2

My first question would be, do you really want to make it such a static non-flexible thing? MOTD means "message of the day" so it's easy to change. If you do it this way with a model then you won't have that degree of flexibility. With this, it can be changed, but it requires creating a new model with a different name and everybody will permanently download each one of them.

Regardless, I feel like I've seen talk of blocking the VGUI (normal) menus/screens before. I'd search for various plugins/threads that involve the VGUI with various terms e.g. block, hide, etc.
__________________

Last edited by fysiks; 01-07-2023 at 00:11.
fysiks is online now
kirksite
Member
Join Date: Feb 2021
Old 01-07-2023 , 01:44   Re: MOTD_Model Replaces default MOTD
Reply With Quote #3

I understand what use MOTD may have been initially intended but my experience is most servers use it as a one-time setup intro to the server and seldom change it.

I thought as an intro the MOTD_Model was flashy and wanted to try it.
kirksite is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:46.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode