Raised This Month: $32 Target: $400
 8% 

Solved [Module] How do I recreate Director HUD Message as a module?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 11-04-2020 , 19:06   [Module] How do I recreate Director HUD Message as a module?
Reply With Quote #1

Title is pretty self-explanatory. I would like to recreate Arkshine's dhudmessage.inc in CPP and tried doing like in the presented code. I've tried both MSG_ONE and MSG_ONE_UNRELIABLE.


Code:
void DHudMessage(CBasePlayer* pPlayer, hudtextparms_t textparms, std::string text) {

    MESSAGE_BEGIN(MSG_ONE_UNRELIABLE, SVC_DIRECTOR, nullptr, pPlayer->pev);
    WRITE_BYTE(strlen(text.c_str()) + 31);
    WRITE_BYTE(DRC_CMD_MESSAGE);
    WRITE_BYTE(textparms.effect);
    WRITE_LONG(textparms.b1 + (textparms.g1 << 8) + (textparms.r1 << 16));
    WRITE_LONG(textparms.x);
    WRITE_LONG(textparms.y);
    WRITE_LONG(textparms.fadeinTime);
    WRITE_LONG(textparms.fadeoutTime);
    WRITE_LONG(textparms.holdTime);
    WRITE_LONG(textparms.fxTime);
    WRITE_STRING(text.c_str());
    MESSAGE_END();
}
This is supposed to print a dhudmessage, without success.

Last edited by redivcram; 11-06-2020 at 09:09. Reason: Solved
redivcram is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 11-06-2020 , 09:12   Re: [Module] How do I recreate Director HUD Message as a module?
Reply With Quote #2

The solution was basically converting (not directly casting) all float values to long. Hence WRITE_LONG.
redivcram 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:54.


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