Difference between revisions of "User Messages"

From AlliedModders Wiki
Jump to: navigation, search
m (added link, csgo usermessage page)
 
(28 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
This is just a dump of some stuff for now, needs a complete revamp later.
 
This is just a dump of some stuff for now, needs a complete revamp later.
 +
Here's a topic on the subject as well: https://forums.alliedmods.net/showthread.php?t=80256 and here http://forums.alliedmods.net/showthread.php?t=52777
 +
 +
{{Note| Protobuf [[Counter-Strike:_Global_Offensive_UserMessages]]}}
 +
  
 
=== Counter-Strike: Source User Messages ===
 
=== Counter-Strike: Source User Messages ===
Line 19: Line 23:
 
                   Fade                              12    10   
 
                   Fade                              12    10   
 
                   VGUIMenu                          13    -1   
 
                   VGUIMenu                          13    -1   
                   CloseCaption                      14    7     
+
                  Rumble                            14    3   
 +
                   CloseCaption                      15    -1 
 +
                  SendAudio                        16    -1 
 +
                  RawAudio                          17    -1 
 +
                  VoiceMask                        18    25 
 +
                  RequestState                      19    0   
 +
                  BarTime                          20    -1 
 +
                  Damage                            21    -1 
 +
                  RadioText                        22    -1 
 +
                  HintText                          23    -1 
 +
                  KeyHintText                      24    -1 
 +
                  ReloadEffect                      25    2   
 +
                  PlayerAnimEvent                  26    -1 
 +
                  AmmoDenied                        27    2   
 +
                  UpdateRadar                      28    -1 
 +
                  KillCam                          29    -1 
 +
                  MarkAchievement                  30    -1 
 +
                  CallVoteFailed                    31    -1 
 +
                  VoteStart                        32    -1 
 +
                  VotePass                          33    -1 
 +
                  VoteFailed                        34    2   
 +
                  VoteSetup                        35    -1 
 +
                  SPHapWeapEvent                    36    4   
 +
                  HapDmg                            37    -1 
 +
                  HapPunch                          38    -1 
 +
                  HapSetDrag                        39    -1 
 +
                  HapSetConst                      40    -1 
 +
                  HapMeleeContact                  41    0   
 +
                  PlayerStatsUpdate_DEPRECATED      42    -1 
 +
                  AchievementEvent                  43    -1 
 +
                  MatchEndConditions                44    -1 
 +
                  MatchStatsUpdate                  45    -1 
 +
                  PlayerStatsUpdate                46    -1 
 +
  47 user messages in total
 +
 
 +
 
 +
=== Left 4 Dead 2 User Messages ===
 +
 
 +
For vote specific user messages see http://wiki.alliedmods.net/Left_4_Voting_2
 +
 
 +
  User Messages:  Name                              Index  Size Parameter types
 +
                  SayText2                          4      -1
 +
                  TextMsg                          5      -1
 +
                  HudMsg                            6      -1
 +
                  ResetHUD                          7      1
 +
                  GameTitle                        8      0
 +
                  ItemPickup                        9      -1
 +
                  ShowMenu                          10    -1
 +
                  Shake                            11    13
 +
                  Fade                              12    10
 +
                  VGUIMenu                          13    -1 string, bool, string (keyvalues)
 +
                  Rumble                            14    3
 +
                  CloseCaption                      15    -1
 +
                  CloseCaptionDirect                16    -1
 +
                  SendAudio                        17    -1
 +
                  RawAudio                          18    -1
 +
                  VoiceMask                        19    9
 +
                  RequestState                      20    0
 +
                  BarTime                          21    -1
 +
                  Damage                            22    -1
 +
                  RadioText                        23    -1
 +
                  HintText                          24    -1
 +
                  KeyHintText                      25    -1
 +
                  ReloadEffect                      26    4
 +
                  PlayerAnimEvent                  27    -1
 +
                  AmmoDenied                        28    2
 +
                  UpdateRadar                      29    -1
 +
                  KillCam                          30    -1
 +
                  MarkAchievement                  31    -1
 +
                  Splatter                          32    1
 +
                  MeleeSlashSplatter                33    1
 +
                  MeleeClubSplatter                34    1
 +
                  MudSplatter                      35    1
 +
                  SplatterClear                    36    0
 +
                  MessageText                      37    -1
 +
                  TransitionRestore                38    0
 +
                  Spawn                            39    1
 +
                  CreditsLine                      40    -1
 +
                  CreditsMsg                        41    0
 +
                  JoinLateMsg                      42    0
 +
                  StatsCrawlMsg                    43    0
 +
                  StatsSkipState                    44    2
 +
                  ShowStats                        45    -1
 +
                  BlurFade                          46    0
 +
                  MusicCmd                          47    -1
 +
                  WitchBloodSplatter                48    -1 vec[3]
 +
                  AchievementEvent                  49    -1
 +
                  PZDmgMsg                          50    -1
 +
                  AllPlayersConnectedGameStarting  51    0
 +
                  VoteRegistered                    52    1
 +
                  DisconnectToLobby                53    0 empty
 +
                  CallVoteFailed                    54    1
 +
                  SteamWeaponStatData              55    -1
 +
                  CurrentTimescale                  56    4
 +
                  DesiredTimescale                  57    16
 +
                  PZEndGamePanelMsg                58    1
 +
                  PZEndGamePanelVoteRegisteredMsg  59    1
 +
                  PZEndGameVoteStatsMsg            60    8
 +
                  VoteStart                        61    -1
 +
                  VotePass                          62    -1
 +
                  VoteFail                          63    1
 +
 
 +
 
 +
=== Team Fortress 2 User Messages ===
 +
 
 +
  User Messages:  Name                              Index  Size
 +
                  Geiger                            0      1   
 +
                  Train                            1      1   
 +
                  HudText                          2      -1 
 +
                  SayText                          3      -1 
 +
                  SayText2                          4      -1 
 +
                  TextMsg                          5      -1 
 +
                  ResetHUD                          6      1   
 +
                  GameTitle                        7     0   
 +
                  ItemPickup                        8      -1 
 +
                  ShowMenu                          9      -1 
 +
                  Shake                            10    13 
 +
                  Fade                              11    10 
 +
                  VGUIMenu                          12    -1 
 +
                  Rumble                            13    3    
 +
                  CloseCaption                      14    -1 
 
                   SendAudio                        15    -1   
 
                   SendAudio                        15    -1   
                   RawAudio                         16     -1   
+
                   VoiceMask                        16    17 
                   VoiceMask                         17     17    
+
                  RequestState                      17    0   
                   RequestState                     18     0    
+
                  Damage                            18    -1 
                   BarTime                          19     -1   
+
                  HintText                         19    -1 
                   Damage                            20     -1   
+
                  KeyHintText                      20    -1 
                   RadioText                         21     -1   
+
                  HudMsg                            21    -1 
                   HintText                         22     -1   
+
                  AmmoDenied                        22    2   
                   ReloadEffect                      23     2     
+
                  AchievementEvent                  23    -1 
                   PlayerAnimEvent                   24     -1   
+
                  UpdateRadar                      24     -1   
                   AmmoDenied                       25     2     
+
                   VoiceSubtitle                    25    3   
                   UpdateRadar                      26     -1   
+
                  HudNotify                         26    2   
                   KillCam                          27     -1   
+
                  HudNotifyCustom                  27    -1 
   28 user messages in total
+
                  PlayerStatsUpdate                28    -1 
 +
                  MapStatsUpdate                    29    -1 
 +
                  PlayerIgnited                    30    3   
 +
                  PlayerIgnitedInv                  31    3   
 +
                  HudArenaNotify                    32    2   
 +
                  UpdateAchievement                33    -1 
 +
                  TrainingMsg                      34    -1 
 +
                  TrainingObjective                35     -1    
 +
                   DamageDodged                     36    -1 
 +
                  PlayerJarated                    37    2   
 +
                  PlayerExtinguished                38    2   
 +
                  PlayerJaratedFade                39    2   
 +
                  PlayerShieldBlocked              40     2    
 +
                   BreakModel                        41    -1 
 +
                  CheapBreakModel                  42    -1 
 +
                  BreakModel_Pumpkin                43    -1 
 +
                  BreakModelRocketDud              44     -1   
 +
                   CallVoteFailed                    45     -1   
 +
                   VoteStart                         46     -1   
 +
                   VotePass                         47    -1 
 +
                  VoteFailed                        48    2   
 +
                  VoteSetup                        49    -1 
 +
                  PlayerBonusPoints                50    3   
 +
                  RDTeamPointsChanged              51    4   
 +
                  SpawnFlyingBird                  52    -1 
 +
                  PlayerGodRayEffect                53    -1 
 +
                  PlayerTeleportHomeEffect          54    -1 
 +
                  MVMStatsReset                    55    -1 
 +
                  MVMPlayerEvent                    56    -1 
 +
                  MVMResetPlayerStats              57     -1   
 +
                   MVMWaveFailed                    58    0   
 +
                  MVMAnnouncement                  59    2   
 +
                  MVMPlayerUpgradedEvent            60    9   
 +
                  MVMVictory                        61     2     
 +
                   MVMWaveChange                    62    15 
 +
                  MVMLocalPlayerUpgradesClear      63    1   
 +
                  MVMLocalPlayerUpgradesValue      64    6   
 +
                  MVMResetPlayerWaveSpendingStats  65    1   
 +
                   MVMLocalPlayerWaveSpendingValue  66    12 
 +
                  MVMResetPlayerUpgradeSpending    67    -1 
 +
                  MVMServerKickTimeUpdate          68    1   
 +
                  PlayerLoadoutUpdated              69    -1 
 +
                  PlayerTauntSoundLoopStart        70    -1 
 +
                  PlayerTauntSoundLoopEnd          71    -1 
 +
                  ForcePlayerViewAngles            72     -1   
 +
                   BonusDucks                       73     2     
 +
                   EOTLDuckEvent                    74    7   
 +
                  PlayerPickupWeapon                75    -1 
 +
                  QuestObjectiveCompleted          76    14 
 +
                  SPHapWeapEvent                    77    4   
 +
                  HapDmg                            78    -1 
 +
                  HapPunch                          79     -1   
 +
                   HapSetDrag                        80     -1   
 +
                  HapSetConst                      81    -1    
 +
                  HapMeleeContact                  82    0
  
 
=== Fade Flags ===
 
=== Fade Flags ===
 +
These may not be correct...
  
 
  FFADE_IN            0x0001        // Just here so we don't pass 0 into the function
 
  FFADE_IN            0x0001        // Just here so we don't pass 0 into the function
Line 43: Line 222:
 
  FFADE_PURGE        0x0010        // Purges all other fades, replacing them with this one
 
  FFADE_PURGE        0x0010        // Purges all other fades, replacing them with this one
  
[[User:DaFox|DaFox]] 00:29, 1 July 2009 (UTC)
+
=== Fade Function ===
 +
Example Fade function (be sure to define the Fade Flags!)
 +
 
 +
This Fades the clients screen to a specified color, and stays until you reset the color to {0,0,0,0}
 +
 
 +
To modify it to Fade the screen for a certain amount of time, remove the STAYOUT flag, and pass a value to "fade & hold"
 +
 
 +
PerformFade(target, 500, {0, 128, 255, 51})
 +
 
 +
PerformFade(client, duration, const color[4]) {
 +
new Handle:hFadeClient=StartMessageOne("Fade",client)
 +
BfWriteShort(hFadeClient,duration) // FIXED 16 bit, with SCREENFADE_FRACBITS fractional, milliseconds duration
 +
BfWriteShort(hFadeClient,0) // FIXED 16 bit, with SCREENFADE_FRACBITS fractional, milliseconds duration until reset (fade & hold)
 +
BfWriteShort(hFadeClient,(FFADE_PURGE|FFADE_OUT|FFADE_STAYOUT)) // fade type (in / out)
 +
BfWriteByte(hFadeClient,color[0]) // fade red
 +
BfWriteByte(hFadeClient,color[1]) // fade green
 +
BfWriteByte(hFadeClient,color[2]) // fade blue
 +
BfWriteByte(hFadeClient,color[3]) // fade alpha
 +
EndMessage()
 +
}
 +
 
 +
=== HudMsg Function ===
 +
This does not work in CS:S.
 +
 
 +
This Draws a text Message to a specified players screen. This is just for educational purposes and there is a much easier way of doing this with native functions here: [https://sm.alliedmods.net/new-api/halflife/ShowHudText ShowHudText] & [https://sm.alliedmods.net/new-api/halflife/SetHudTextParams SetHudTextParams]
 +
 
 +
PerformHudMsg(client, "This is a Test")
 +
 
 +
PerformHudMsg(client, const String:szMsg[]) {
 +
new Handle:hBf = StartMessageOne("HudMsg", client)
 +
BfWriteByte(hBf, 3) //channel
 +
BfWriteFloat(hBf, 0.0); // x ( -1 = center )
 +
BfWriteFloat(hBf, -1); // y ( -1 = center )
 +
// second color
 +
BfWriteByte(hBf, 0); //r1
 +
BfWriteByte(hBf, 0); //g1
 +
BfWriteByte(hBf, 255); //b1
 +
BfWriteByte(hBf, 255); //a1 // transparent?
 +
// init color
 +
BfWriteByte(hBf, 255); //r2
 +
BfWriteByte(hBf, 0); //g2
 +
BfWriteByte(hBf, 0); //b2
 +
BfWriteByte(hBf, 255); //a2
 +
BfWriteByte(hBf, 0); //effect (0 is fade in/fade out; 1 is flickery credits; 2 is write out)
 +
BfWriteFloat(hBf, 1.0); //fadeinTime (message fade in time - per character in effect 2)
 +
BfWriteFloat(hBf, 1.0); //fadeoutTime
 +
BfWriteFloat(hBf, 15.0); //holdtime
 +
BfWriteFloat(hBf, 5.0); //fxtime (effect type(2) used)
 +
BfWriteString(hBf, szMsg); //Message
 +
EndMessage();
 +
}
 +
 
 +
=== HookUserMessage Fade ===
 +
Some sample code to hook a UserMessage, In this case Fade.
 +
You cannot send other UserMessages inside of a UserMessage Hook. Many simple functions such as PrintToChat call UserMessages.
 +
 
 +
public OnPluginStart() {
 +
    HookUserMessage(GetUserMessageId("Fade"),HookFade,true)
 +
}
 +
 
 +
public Action:HookFade(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init) {
 +
new duration = BfReadShort(bf)
 +
new holdtime = BfReadShort(bf)
 +
BfReadShort(bf) //You must read all of the bf values, even If you only want the last value such as this one.
 +
new r = BfReadByte(bf) //You do NOT need to store their value though.
 +
new g = BfReadByte(bf)
 +
new b = BfReadByte(bf)
 +
new a = BfReadByte(bf)
 +
 +
PrintToServer("Duration: %i, HoldTime: %i, rgba: %i %i %i %i",duration,holdtime,r,g,b,a)
 +
}
 +
 
 +
[[Category:SourceMod Scripting]]

Latest revision as of 18:53, 30 December 2018

This is just a dump of some stuff for now, needs a complete revamp later. Here's a topic on the subject as well: https://forums.alliedmods.net/showthread.php?t=80256 and here http://forums.alliedmods.net/showthread.php?t=52777

Note: Protobuf Counter-Strike:_Global_Offensive_UserMessages


Counter-Strike: Source User Messages

List obtained by using 'meta game' in the console

 User Messages:  Name                              Index  Size 
                 Geiger                            0      1    
                 Train                             1      1    
                 HudText                           2      -1   
                 SayText                           3      -1   
                 SayText2                          4      -1   
                 TextMsg                           5      -1   
                 HudMsg                            6      -1   
                 ResetHUD                          7      1    
                 GameTitle                         8      0    
                 ItemPickup                        9      -1   
                 ShowMenu                          10     -1   
                 Shake                             11     13   
                 Fade                              12     10   
                 VGUIMenu                          13     -1   
                 Rumble                            14     3    
                 CloseCaption                      15     -1   
                 SendAudio                         16     -1   
                 RawAudio                          17     -1   
                 VoiceMask                         18     25   
                 RequestState                      19     0    
                 BarTime                           20     -1   
                 Damage                            21     -1   
                 RadioText                         22     -1   
                 HintText                          23     -1   
                 KeyHintText                       24     -1   
                 ReloadEffect                      25     2    
                 PlayerAnimEvent                   26     -1   
                 AmmoDenied                        27     2    
                 UpdateRadar                       28     -1   
                 KillCam                           29     -1   
                 MarkAchievement                   30     -1   
                 CallVoteFailed                    31     -1   
                 VoteStart                         32     -1   
                 VotePass                          33     -1   
                 VoteFailed                        34     2    
                 VoteSetup                         35     -1   
                 SPHapWeapEvent                    36     4    
                 HapDmg                            37     -1   
                 HapPunch                          38     -1   
                 HapSetDrag                        39     -1   
                 HapSetConst                       40     -1   
                 HapMeleeContact                   41     0    
                 PlayerStatsUpdate_DEPRECATED      42     -1   
                 AchievementEvent                  43     -1   
                 MatchEndConditions                44     -1   
                 MatchStatsUpdate                  45     -1   
                 PlayerStatsUpdate                 46     -1   
 47 user messages in total


Left 4 Dead 2 User Messages

For vote specific user messages see http://wiki.alliedmods.net/Left_4_Voting_2

 User Messages:  Name                              Index  Size Parameter types
                 SayText2                          4      -1
                 TextMsg                           5      -1
                 HudMsg                            6      -1
                 ResetHUD                          7      1
                 GameTitle                         8      0
                 ItemPickup                        9      -1
                 ShowMenu                          10     -1
                 Shake                             11     13
                 Fade                              12     10
                 VGUIMenu                          13     -1	string, bool, string (keyvalues)
                 Rumble                            14     3
                 CloseCaption                      15     -1
                 CloseCaptionDirect                16     -1
                 SendAudio                         17     -1
                 RawAudio                          18     -1
                 VoiceMask                         19     9
                 RequestState                      20     0
                 BarTime                           21     -1
                 Damage                            22     -1
                 RadioText                         23     -1
                 HintText                          24     -1
                 KeyHintText                       25     -1
                 ReloadEffect                      26     4
                 PlayerAnimEvent                   27     -1
                 AmmoDenied                        28     2
                 UpdateRadar                       29     -1
                 KillCam                           30     -1
                 MarkAchievement                   31     -1
                 Splatter                          32     1
                 MeleeSlashSplatter                33     1
                 MeleeClubSplatter                 34     1
                 MudSplatter                       35     1
                 SplatterClear                     36     0
                 MessageText                       37     -1
                 TransitionRestore                 38     0
                 Spawn                             39     1
                 CreditsLine                       40     -1
                 CreditsMsg                        41     0
                 JoinLateMsg                       42     0
                 StatsCrawlMsg                     43     0
                 StatsSkipState                    44     2
                 ShowStats                         45     -1
                 BlurFade                          46     0
                 MusicCmd                          47     -1
                 WitchBloodSplatter                48     -1	vec[3]
                 AchievementEvent                  49     -1
                 PZDmgMsg                          50     -1
                 AllPlayersConnectedGameStarting   51     0
                 VoteRegistered                    52     1
                 DisconnectToLobby                 53     0	empty
                 CallVoteFailed                    54     1
                 SteamWeaponStatData               55     -1
                 CurrentTimescale                  56     4
                 DesiredTimescale                  57     16
                 PZEndGamePanelMsg                 58     1
                 PZEndGamePanelVoteRegisteredMsg   59     1
                 PZEndGameVoteStatsMsg             60     8
                 VoteStart                         61     -1
                 VotePass                          62     -1
                 VoteFail                          63     1


Team Fortress 2 User Messages

 User Messages:  Name                              Index  Size
                 Geiger                            0      1    
                 Train                             1      1    
                 HudText                           2      -1   
                 SayText                           3      -1   
                 SayText2                          4      -1   
                 TextMsg                           5      -1   
                 ResetHUD                          6      1    
                 GameTitle                         7      0    
                 ItemPickup                        8      -1   
                 ShowMenu                          9      -1   
                 Shake                             10     13   
                 Fade                              11     10   
                 VGUIMenu                          12     -1   
                 Rumble                            13     3    
                 CloseCaption                      14     -1   
                 SendAudio                         15     -1   
                 VoiceMask                         16     17   
                 RequestState                      17     0    
                 Damage                            18     -1   
                 HintText                          19     -1   
                 KeyHintText                       20     -1   
                 HudMsg                            21     -1   
                 AmmoDenied                        22     2    
                 AchievementEvent                  23     -1   
                 UpdateRadar                       24     -1   
                 VoiceSubtitle                     25     3    
                 HudNotify                         26     2    
                 HudNotifyCustom                   27     -1   
                 PlayerStatsUpdate                 28     -1   
                 MapStatsUpdate                    29     -1   
                 PlayerIgnited                     30     3    
                 PlayerIgnitedInv                  31     3    
                 HudArenaNotify                    32     2    
                 UpdateAchievement                 33     -1   
                 TrainingMsg                       34     -1   
                 TrainingObjective                 35     -1   
                 DamageDodged                      36     -1   
                 PlayerJarated                     37     2    
                 PlayerExtinguished                38     2    
                 PlayerJaratedFade                 39     2    
                 PlayerShieldBlocked               40     2    
                 BreakModel                        41     -1   
                 CheapBreakModel                   42     -1   
                 BreakModel_Pumpkin                43     -1   
                 BreakModelRocketDud               44     -1   
                 CallVoteFailed                    45     -1   
                 VoteStart                         46     -1   
                 VotePass                          47     -1   
                 VoteFailed                        48     2    
                 VoteSetup                         49     -1   
                 PlayerBonusPoints                 50     3    
                 RDTeamPointsChanged               51     4    
                 SpawnFlyingBird                   52     -1   
                 PlayerGodRayEffect                53     -1   
                 PlayerTeleportHomeEffect          54     -1   
                 MVMStatsReset                     55     -1   
                 MVMPlayerEvent                    56     -1   
                 MVMResetPlayerStats               57     -1   
                 MVMWaveFailed                     58     0    
                 MVMAnnouncement                   59     2    
                 MVMPlayerUpgradedEvent            60     9    
                 MVMVictory                        61     2    
                 MVMWaveChange                     62     15   
                 MVMLocalPlayerUpgradesClear       63     1    
                 MVMLocalPlayerUpgradesValue       64     6    
                 MVMResetPlayerWaveSpendingStats   65     1    
                 MVMLocalPlayerWaveSpendingValue   66     12   
                 MVMResetPlayerUpgradeSpending     67     -1   
                 MVMServerKickTimeUpdate           68     1    
                 PlayerLoadoutUpdated              69     -1   
                 PlayerTauntSoundLoopStart         70     -1   
                 PlayerTauntSoundLoopEnd           71     -1   
                 ForcePlayerViewAngles             72     -1   
                 BonusDucks                        73     2    
                 EOTLDuckEvent                     74     7    
                 PlayerPickupWeapon                75     -1   
                 QuestObjectiveCompleted           76     14   
                 SPHapWeapEvent                    77     4    
                 HapDmg                            78     -1   
                 HapPunch                          79     -1   
                 HapSetDrag                        80     -1   
                 HapSetConst                       81     -1   
                 HapMeleeContact                   82     0

Fade Flags

These may not be correct...

FFADE_IN            0x0001        // Just here so we don't pass 0 into the function
FFADE_OUT           0x0002        // Fade out (not in)
FFADE_MODULATE      0x0004        // Modulate (don't blend)
FFADE_STAYOUT       0x0008        // ignores the duration, stays faded out until new ScreenFade message received
FFADE_PURGE         0x0010        // Purges all other fades, replacing them with this one

Fade Function

Example Fade function (be sure to define the Fade Flags!)

This Fades the clients screen to a specified color, and stays until you reset the color to {0,0,0,0}

To modify it to Fade the screen for a certain amount of time, remove the STAYOUT flag, and pass a value to "fade & hold"

PerformFade(target, 500, {0, 128, 255, 51})
PerformFade(client, duration, const color[4]) {
	new Handle:hFadeClient=StartMessageOne("Fade",client)
	BfWriteShort(hFadeClient,duration)	// FIXED 16 bit, with SCREENFADE_FRACBITS fractional, milliseconds duration
	BfWriteShort(hFadeClient,0)		// FIXED 16 bit, with SCREENFADE_FRACBITS fractional, milliseconds duration until reset (fade & hold)
	BfWriteShort(hFadeClient,(FFADE_PURGE|FFADE_OUT|FFADE_STAYOUT)) // fade type (in / out)
	BfWriteByte(hFadeClient,color[0])	// fade red
	BfWriteByte(hFadeClient,color[1])	// fade green
	BfWriteByte(hFadeClient,color[2])	// fade blue
	BfWriteByte(hFadeClient,color[3])	// fade alpha
	EndMessage()
}

HudMsg Function

This does not work in CS:S.

This Draws a text Message to a specified players screen. This is just for educational purposes and there is a much easier way of doing this with native functions here: ShowHudText & SetHudTextParams

PerformHudMsg(client, "This is a Test")
PerformHudMsg(client, const String:szMsg[]) {
	new Handle:hBf = StartMessageOne("HudMsg", client)
	BfWriteByte(hBf, 3) //channel
	BfWriteFloat(hBf, 0.0); // x ( -1 = center )
	BfWriteFloat(hBf, -1); // y ( -1 = center )
	// second color
	BfWriteByte(hBf, 0); //r1
	BfWriteByte(hBf, 0); //g1
	BfWriteByte(hBf, 255); //b1
	BfWriteByte(hBf, 255); //a1 // transparent?
	// init color
	BfWriteByte(hBf, 255); //r2
	BfWriteByte(hBf, 0); //g2
	BfWriteByte(hBf, 0); //b2
	BfWriteByte(hBf, 255); //a2
	BfWriteByte(hBf, 0); //effect (0 is fade in/fade out; 1 is flickery credits; 2 is write out)
	BfWriteFloat(hBf, 1.0); //fadeinTime (message fade in time - per character in effect 2)
	BfWriteFloat(hBf, 1.0); //fadeoutTime
	BfWriteFloat(hBf, 15.0); //holdtime
	BfWriteFloat(hBf, 5.0); //fxtime (effect type(2) used)
	BfWriteString(hBf, szMsg); //Message
	EndMessage();
}

HookUserMessage Fade

Some sample code to hook a UserMessage, In this case Fade. You cannot send other UserMessages inside of a UserMessage Hook. Many simple functions such as PrintToChat call UserMessages.

public OnPluginStart() {
    HookUserMessage(GetUserMessageId("Fade"),HookFade,true)
}
public Action:HookFade(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init) {
	new duration = BfReadShort(bf)
	new holdtime = BfReadShort(bf)
	BfReadShort(bf) 	//You must read all of the bf values, even If you only want the last value such as this one.
	new r = BfReadByte(bf) 	//You do NOT need to store their value though.
	new g = BfReadByte(bf)
	new b = BfReadByte(bf)
	new a = BfReadByte(bf)
	
	PrintToServer("Duration: %i, HoldTime: %i, rgba: %i %i %i %i",duration,holdtime,r,g,b,a)
}