Quote:
Originally Posted by killerZM
ok bro tyvm
when you find the way of making HUD and menu tell me please
|
CareFull With Channels on normal hudmessage. -1 channel is not working here.
FIT = FadeInTime
FOT = FadeOutTime
HT = HoldTime
FT = FxTime (Effects)
Code:
inline unsigned short FU16(float value, float scale)
{
int output;
output = value * scale;
if (output < 0)
output = 0;
if (output > 0xFFFF)
output = 0xFFFF;
return (unsigned short)output;
}
inline unsigned short FS16(float value, float scale)
{
int output;
output = value * scale;
if (output > 32767)
output = 32767;
if (output < -32768)
output = -32768;
return (short)output;
}
void _fastcall ShowHUDMessage(edict_t *pEdict, float X, float Y, int Effects, int R, int G, int B, float FIT, float FOT, float HT, float FXTime, int Channel, char Message[])
{
if (pEdict)
MESSAGE_BEGIN(MSG_ONE, SVC_TEMPENTITY, NULL, pEdict);
else
MESSAGE_BEGIN(MSG_BROADCAST, SVC_DIRECTOR, NULL, NULL);
WRITE_BYTE(TE_TEXTMESSAGE);
WRITE_BYTE(Channel & 0xFF);
WRITE_SHORT(FS16(X, 1 << 13));
WRITE_SHORT(FS16(Y, 1 << 13));
WRITE_BYTE(Effects);
WRITE_BYTE(R);
WRITE_BYTE(G);
WRITE_BYTE(B);
WRITE_BYTE(0);
WRITE_BYTE(255);
WRITE_BYTE(255);
WRITE_BYTE(255);
WRITE_BYTE(0);
WRITE_SHORT(FU16(FIT, 1 << 8));
WRITE_SHORT(FU16(FOT, 1 << 8));
WRITE_SHORT(FU16(HT, 1 << 8));
WRITE_STRING(Message);
MESSAGE_END();
}
void _fastcall ShowDHUDMessage(edict_t *pEntity, float X, float Y, int Effects, int R, int G, int B, float FIT, float FOT, float HT, float FT, const char *pMessage, int Length)
{
#define DRC_CMD_MESSAGE 6
if (pEntity)
MESSAGE_BEGIN(MSG_ONE_UNRELIABLE, SVC_DIRECTOR, NULL, pEntity);
else
MESSAGE_BEGIN(MSG_BROADCAST, SVC_DIRECTOR, NULL, NULL);
WRITE_BYTE(Length);
WRITE_BYTE(DRC_CMD_MESSAGE);
WRITE_BYTE(Effects);
WRITE_LONG((unsigned char)B + ((unsigned char)G << 8) + ((unsigned char)R << 16));
WRITE_LONG((*((cell*)&X)));
WRITE_LONG((*((cell*)&Y)));
WRITE_LONG((*((cell*)&FIT)));
WRITE_LONG((*((cell*)&FOT)));
WRITE_LONG((*((cell*)&HT)));
WRITE_LONG((*((cell*)&FT)));
WRITE_STRING(pMessage);
MESSAGE_END();
}