From d1fc99fc285fa8e138e0b232eecd2618c8cba3cf Mon Sep 17 00:00:00 2001 From: Franco Romaniello Date: Mon, 16 Aug 2021 22:27:50 +0200 Subject: [PATCH] [FEATURE REQUEST] set_hudmessage add missing parameters (#981) --- amxmodx/amxmodx.cpp | 26 ++++++++++++++++++++------ amxmodx/util.cpp | 10 +++++----- plugins/include/amxmodx.inc | 8 +++++--- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 55d9c0d8..fb861408 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -525,13 +525,27 @@ static cell AMX_NATIVE_CALL next_hudchannel(AMX *amx, cell *params) return pPlayer->NextHUDChannel(); } -static cell AMX_NATIVE_CALL set_hudmessage(AMX *amx, cell *params) /* 11 param */ +static cell AMX_NATIVE_CALL set_hudmessage(AMX *amx, cell *params) /* 13 param */ { - g_hudset.a1 = 0; - g_hudset.a2 = 0; - g_hudset.r2 = 255; - g_hudset.g2 = 255; - g_hudset.b2 = 250; + cell num_params = params[0] / sizeof(cell); + + if(num_params >= 13) { + cell *color2 = get_amxaddr(amx, params[13]); + + g_hudset.a1 = params[12]; + g_hudset.a2 = color2[0]; + g_hudset.r2 = color2[1]; + g_hudset.g2 = color2[2]; + g_hudset.b2 = color2[3]; + } + else { + g_hudset.a1 = 0; + g_hudset.a2 = 0; + g_hudset.r2 = 255; + g_hudset.g2 = 255; + g_hudset.b2 = 250; + } + g_hudset.r1 = static_cast(params[1]); g_hudset.g1 = static_cast(params[2]); g_hudset.b1 = static_cast(params[3]); diff --git a/amxmodx/util.cpp b/amxmodx/util.cpp index 25c55de1..d09b032c 100755 --- a/amxmodx/util.cpp +++ b/amxmodx/util.cpp @@ -221,11 +221,11 @@ void UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const ch WRITE_BYTE(textparms.r1); WRITE_BYTE(textparms.g1); WRITE_BYTE(textparms.b1); - WRITE_BYTE(0); - WRITE_BYTE(255); - WRITE_BYTE(255); - WRITE_BYTE(250); - WRITE_BYTE(0); + WRITE_BYTE(textparms.a1); + WRITE_BYTE(textparms.r2); + WRITE_BYTE(textparms.g2); + WRITE_BYTE(textparms.b2); + WRITE_BYTE(textparms.a2); WRITE_SHORT(FixedUnsigned16(textparms.fadeinTime, (1<<8))); WRITE_SHORT(FixedUnsigned16(textparms.fadeoutTime, (1<<8))); WRITE_SHORT(FixedUnsigned16(textparms.holdTime, (1<<8))); diff --git a/plugins/include/amxmodx.inc b/plugins/include/amxmodx.inc index 2d734802..551eac89 100755 --- a/plugins/include/amxmodx.inc +++ b/plugins/include/amxmodx.inc @@ -670,7 +670,7 @@ native disable_logevent(handle); * * @param red Red component of hudmessage color * @param green Green component of hudmessage color - * @param blue Blue component of hudmessage color + * @param blue Blue component of hudmessage color * @param x Location of the message on the x axis in percent * @param y Location of the message on the y axis in percent * @param effects Display effect @@ -679,10 +679,12 @@ native disable_logevent(handle); * @param fadeintime Time it takes the message to fully appear (fade-in) * @param fadeouttime Time it takes the message to fully disappear (fade-out) * @param channel Channel to use on the client - * + * @param alpha1 Alpha component of hudmessage color + * @param color2[4] Color 2 array {r,g,b,a} + * * @noreturn */ -native set_hudmessage(red = 200, green = 100, blue = 0, Float:x = -1.0, Float:y = 0.35, effects = 0, Float:fxtime = 6.0, Float:holdtime = 12.0, Float:fadeintime = 0.1, Float:fadeouttime = 0.2, channel = -1); +native set_hudmessage(red = 200, green = 100, blue = 0, Float:x = -1.0, Float:y = 0.35, effects = 0, Float:fxtime = 6.0, Float:holdtime = 12.0, Float:fadeintime = 0.1, Float:fadeouttime = 0.2, channel = -1, alpha1 = 0, color2[4] = {255, 255, 250, 0}); /** * Displays a message on the client HUD.