Difference between revisions of "Counter-Strike: Global Offensive UserMessages"
(Provide an example for the fade user message) |
(Fade - Add link for Q format + Fix example) |
||
Line 115: | Line 115: | ||
{{end-hl2msg}} | {{end-hl2msg}} | ||
− | '''Command:''' | + | '''Shake.Command:''' |
+ | |||
<sourcepawn> | <sourcepawn> | ||
#define SHAKE_START (0) // Starts the screen shake for all players within the radius | #define SHAKE_START (0) // Starts the screen shake for all players within the radius | ||
Line 134: | Line 135: | ||
{{end-hl2msg}} | {{end-hl2msg}} | ||
− | '''Duration:''' | + | '''Fade.Duration:''' |
+ | |||
+ | Even if a 32 bits integer is requested, the value must be in [https://en.wikipedia.org/wiki/Q_(number_format) Q7.9 format] ! | ||
− | + | '''Fade.HoldTime:''' | |
− | |||
− | + | Even if a 32 bits integer is requested, the value must be in [https://en.wikipedia.org/wiki/Q_(number_format) Q7.9 format] ! | |
− | + | '''Fade.Flags:''' | |
− | |||
− | |||
<sourcepawn> | <sourcepawn> | ||
#define FFADE_IN (0x0001) // Fade in | #define FFADE_IN (0x0001) // Fade in | ||
Line 153: | Line 153: | ||
</sourcepawn> | </sourcepawn> | ||
− | ''' | + | '''Stocks:''' |
+ | |||
<sourcepawn> | <sourcepawn> | ||
#define CSGO_SCREENFADE_FRACTIONAL_BITS (9) | #define CSGO_SCREENFADE_FRACTIONAL_BITS (9) | ||
− | stock int | + | // ---------------------------------------------------------------- |
+ | // Convert a float to a fixed 16 bits | ||
+ | // ---------------------------------------------------------------- | ||
+ | stock int FloatToFixed16(float input, int nb_fractional_bits) | ||
{ | { | ||
− | int output = RoundFloat(input * | + | int output = RoundFloat(input * (1 << nb_fractional_bits)); |
+ | |||
+ | if (output < 0) output = 0; | ||
+ | if (output > 65535) output = 65535; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
return output; | return output; | ||
} | } | ||
+ | // ---------------------------------------------------------------- | ||
+ | // Fade the screen of a client | ||
+ | // ---------------------------------------------------------------- | ||
stock void CSGO_ScreenFadeClient(int clientIndex, float duration, float holdTime, int flags, int color[4]) | stock void CSGO_ScreenFadeClient(int clientIndex, float duration, float holdTime, int flags, int color[4]) | ||
{ | { | ||
Protobuf message = UserMessageToProtobuf(StartMessageOne("Fade", clientIndex, USERMSG_RELIABLE)); | Protobuf message = UserMessageToProtobuf(StartMessageOne("Fade", clientIndex, USERMSG_RELIABLE)); | ||
− | + | ||
− | message.SetInt ("duration", | + | message.SetInt ("duration", FloatToFixed16(duration, CSGO_SCREENFADE_FRACTIONAL_BITS)); |
− | message.SetInt ("hold_time", | + | message.SetInt ("hold_time", FloatToFixed16(holdTime, CSGO_SCREENFADE_FRACTIONAL_BITS)); |
message.SetInt ("flags", flags); | message.SetInt ("flags", flags); | ||
message.SetColor("clr", color); | message.SetColor("clr", color); | ||
Line 194: | Line 195: | ||
{{end-hl2msg}} | {{end-hl2msg}} | ||
− | '''Index:''' | + | '''Rumble.Index:''' |
+ | |||
<sourcepawn> | <sourcepawn> | ||
#define RUMBLE_INVALID (-1) | #define RUMBLE_INVALID (-1) | ||
Line 227: | Line 229: | ||
</sourcepawn> | </sourcepawn> | ||
− | '''Flags:''' | + | '''Rumble.Flags:''' |
+ | |||
<sourcepawn> | <sourcepawn> | ||
#define RUMBLE_FLAGS_NONE (0x0000) | #define RUMBLE_FLAGS_NONE (0x0000) |
Revision as of 05:50, 20 December 2020
Counter-Strike: Global Offensive uses Google's Protocol Buffers instead of Valve's traditional UserMessages.
The data on this page was read from [1]. The initial versions of these files were provided by Valve and updated by the AlliedModders staff.
//====== Copyright (c) 2013, Valve Corporation, All rights reserved. ========// // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF // THE POSSIBILITY OF SUCH DAMAGE. //===========================================================================// // // Purpose: The file defines our Google Protocol Buffers which are used in over // the wire messages for the Source engine. // //=============================================================================
Contents
- 1 VGUIMenu
- 2 Geiger
- 3 Train
- 4 HudText
- 5 SayText
- 6 SayText2
- 7 TextMsg
- 8 HudMsg
- 9 Shake
- 10 Fade
- 11 Rumble
- 12 CloseCaption
- 13 CloseCaptionDirect
- 14 SendAudio
- 15 RawAudio
- 16 VoiceMask
- 17 Damage
- 18 RadioText
- 19 HintText
- 20 KeyHintText
- 21 ProcessSpottedEntityUpdate
- 22 SendPlayerItemDrops
- 23 SendPlayerItemFound
- 24 RetakeUpdatePlayerCardList
- 25 RetakeUpdatePlayerCardSelection
- 26 ReloadEffect
- 27 WeaponSound
- 28 UpdateScreenHealthBar
- 29 EntityOutlineHighlight
- 30 AdjustMoney
- 31 ReportHit
- 32 KillCam
- 33 DesiredTimescale
- 34 CurrentTimescale
- 35 AchievementEvent
- 36 MatchEndConditions
- 37 PlayerStatsUpdate
- 38 DisplayInventory
- 39 QuestProgress
- 40 ScoreLeaderboardData
- 41 PlayerDecalDigitalSignature
- 42 XRankGet
- 43 XRankUpd
- 44 CallVoteFailed
- 45 VoteStart
- 46 VotePass
- 47 VoteFailed
- 48 VoteSetup
- 49 SendLastKillerDamageToClient
- 50 ServerRankUpdate
- 51 XpUpdate
- 52 ItemPickup
- 53 ShowMenu
- 54 BarTime
- 55 AmmoDenied
- 56 MarkAchievement
- 57 MatchStatsUpdate
- 58 ItemDrop
- 59 GlowPropTurnOff
- 60 RoundBackupFilenames
- 61 SSUI
- 62 SurvivalStats
- 63 EndOfMatchAllPlayersData
- 64 RoundImpactScoreData
- 65 CurrentRoundOdds
- 66 DeepStats
- 67 ResetHud
- 68 GameTitle
- 69 RequestState
- 70 StopSpectatorMode
- 71 DisconnectToLobby
- 72 WarmupHasEnded
- 73 ClientInfo
- 74 ServerRankRevealAll
VGUIMenu
Name: | VGUIMenu.SubKey | ||||||
Structure: |
|
Name: | VGUIMenu | |||||||||
Structure: |
|
Geiger
Name: | Geiger | |||
Structure: |
|
Train
Name: | Train | |||
Structure: |
|
HudText
Name: | HudText | |||
Structure: |
|
SayText
Name: | SayText | ||||||||||||
Structure: |
|
SayText2
Note: As of this writing, params requires four empty strings or it will crash the client
Name: | SayText2 | |||||||||||||||
Structure: |
|
TextMsg
Name: | TextMsg | ||||||
Structure: |
|
HudMsg
Name: | HudMsg | ||||||||||||||||||||||||||||||
Structure: |
|
Shake
Name: | Shake | ||||||||||||
Structure: |
|
Shake.Command:
#define SHAKE_START (0) // Starts the screen shake for all players within the radius #define SHAKE_STOP (1) // Stops the screen shake for all players within the radius #define SHAKE_AMPLITUDE (2) // Modifies the amplitude of an active screen shake for all players within the radius #define SHAKE_FREQUENCY (3) // Modifies the frequency of an active screen shake for all players within the radius #define SHAKE_START_RUMBLEONLY (4) // Starts a shake effect that only rumbles the controller, no screen effect #define SHAKE_START_NORUMBLE (5) // Starts a shake that does NOT rumble the controller
Fade
Name: | Fade | ||||||||||||
Structure: |
|
Fade.Duration:
Even if a 32 bits integer is requested, the value must be in Q7.9 format !
Fade.HoldTime:
Even if a 32 bits integer is requested, the value must be in Q7.9 format !
Fade.Flags:
#define FFADE_IN (0x0001) // Fade in #define FFADE_OUT (0x0002) // Fade out #define FFADE_MODULATE (0x0004) // Modulate (Don't blend) #define FFADE_STAYOUT (0x0008) // Ignores the duration, stays faded out until a new fade message is received #define FFADE_PURGE (0x0010) // Purges all other fades, replacing them with this one
Stocks:
#define CSGO_SCREENFADE_FRACTIONAL_BITS (9) // ---------------------------------------------------------------- // Convert a float to a fixed 16 bits // ---------------------------------------------------------------- stock int FloatToFixed16(float input, int nb_fractional_bits) { int output = RoundFloat(input * (1 << nb_fractional_bits)); if (output < 0) output = 0; if (output > 65535) output = 65535; return output; } // ---------------------------------------------------------------- // Fade the screen of a client // ---------------------------------------------------------------- stock void CSGO_ScreenFadeClient(int clientIndex, float duration, float holdTime, int flags, int color[4]) { Protobuf message = UserMessageToProtobuf(StartMessageOne("Fade", clientIndex, USERMSG_RELIABLE)); message.SetInt ("duration", FloatToFixed16(duration, CSGO_SCREENFADE_FRACTIONAL_BITS)); message.SetInt ("hold_time", FloatToFixed16(holdTime, CSGO_SCREENFADE_FRACTIONAL_BITS)); message.SetInt ("flags", flags); message.SetColor("clr", color); EndMessage(); }
Rumble
Name: | Rumble | |||||||||
Structure: |
|
Rumble.Index:
#define RUMBLE_INVALID (-1) #define RUMBLE_STOP_ALL (0) // Cease all current rumbling effects. #define RUMBLE_PISTOL (1) #define RUMBLE_357 (2) #define RUMBLE_SMG1 (3) #define RUMBLE_AR2 (4) #define RUMBLE_SHOTGUN_SINGLE (5) #define RUMBLE_SHOTGUN_DOUBLE (6) #define RUMBLE_AR2_ALT_FIRE (7) #define RUMBLE_RPG_MISSILE (8) #define RUMBLE_CROWBAR_SWING (9) #define RUMBLE_AIRBOAT_GUN (10) #define RUMBLE_JEEP_ENGINE_LOOP (11) #define RUMBLE_FLAT_LEFT (12) #define RUMBLE_FLAT_RIGHT (13) #define RUMBLE_FLAT_BOTH (14) #define RUMBLE_DMG_LOW (15) #define RUMBLE_DMG_MED (16) #define RUMBLE_DMG_HIGH (17) #define RUMBLE_FALL_LONG (18) #define RUMBLE_FALL_SHORT (19) #define RUMBLE_PHYSCANNON_OPEN (20) #define RUMBLE_PHYSCANNON_PUNT (21) #define RUMBLE_PHYSCANNON_LOW (22) #define RUMBLE_PHYSCANNON_MEDIUM (23) #define RUMBLE_PHYSCANNON_HIGH (24) #define RUMBLE_PORTALGUN_LEFT (25) #define RUMBLE_PORTALGUN_RIGHT (26) #define RUMBLE_PORTAL_PLACEMENT_FAILURE (27)
Rumble.Flags:
#define RUMBLE_FLAGS_NONE (0x0000) #define RUMBLE_FLAG_STOP (0x0001) // Stop any instance of this type of effect that's already playing #define RUMBLE_FLAG_LOOP (0x0002) // Make this effect loop #define RUMBLE_FLAG_RESTART (0x0004) // If this effect is already playing, restart it #define RUMBLE_FLAG_UPDATE_SCALE (0x0008) // Apply DATA to this effect if already playing, but don't restart #define RUMBLE_FLAG_ONLYONE (0x0010) // Don't play this effect if it is already playing #define RUMBLE_FLAG_RANDOM_AMPLITUDE (0x0020) // Amplitude scale will be randomly chosen (Between 10% and 100%) #define RUMBLE_FLAG_INITIAL_SCALE (0x0040) // Data is the initial scale to start this effect (* 100)
CloseCaption
Name: | CloseCaption | ||||||||||||
Structure: |
|
CloseCaptionDirect
Name: | CloseCaptionDirect | |||||||||
Structure: |
|
SendAudio
Name: | SendAudio | |||
Structure: |
|
RawAudio
Name: | RawAudio | ||||||||||||
Structure: |
|
VoiceMask
Name: | VoiceMask.PlayerMask | ||||||
Structure: |
|
Name: | VoiceMask | ||||||
Structure: |
|
Damage
Name: | Damage | |||||||||
Structure: |
|
RadioText
Name: | RadioText | ||||||||||||
Structure: |
|
HintText
Name: | HintText | |||
Structure: |
|
KeyHintText
Name: | KeyHintText | |||
Structure: |
|
ProcessSpottedEntityUpdate
Note: gurjeets - Message below is slightly bigger in size than the non-protobuf version, by around 8 bits.
Name: | ProcessSpottedEntityUpdate.SpottedEntityUpdate | |||||||||||||||||||||||||||
Structure: |
|
Name: | ProcessSpottedEntityUpdate | ||||||
Structure: |
|
SendPlayerItemDrops
Name: | SendPlayerItemDrops | |||
Structure: |
|
SendPlayerItemFound
Name: | SendPlayerItemFound | ||||||
Structure: |
|
RetakeUpdatePlayerCardList
Name: | RetakeUpdatePlayerCardList | |||||||||||||||||||||||||||
Structure: |
|
RetakeUpdatePlayerCardSelection
Name: | RetakeUpdatePlayerCardSelection | ||||||||||||
Structure: |
|
ReloadEffect
Name: | ReloadEffect | |||||||||||||||
Structure: |
|
WeaponSound
Name: | WeaponSound | ||||||||||||||||||
Structure: |
|
UpdateScreenHealthBar
Name: | UpdateScreenHealthBar | ||||||||||||
Structure: |
|
EntityOutlineHighlight
Name: | EntityOutlineHighlight | ||||||
Structure: |
|
AdjustMoney
Name: | AdjustMoney | |||
Structure: |
|
ReportHit
Name: | ReportHit | ||||||||||||
Structure: |
|
KillCam
Name: | KillCam | |||||||||
Structure: |
|
DesiredTimescale
Name: | DesiredTimescale | ||||||||||||
Structure: |
|
CurrentTimescale
Name: | CurrentTimescale | |||
Structure: |
|
AchievementEvent
Name: | AchievementEvent | |||||||||
Structure: |
|
MatchEndConditions
Name: | MatchEndConditions | ||||||||||||
Structure: |
|
PlayerStatsUpdate
Name: | PlayerStatsUpdate.Stat | ||||||
Structure: |
|
Name: | PlayerStatsUpdate | ||||||||||||
Structure: |
|
DisplayInventory
Name: | DisplayInventory | ||||||
Structure: |
|
QuestProgress
Name: | QuestProgress | ||||||||||||
Structure: |
|
ScoreLeaderboardData
Name: | ScoreLeaderboardData | |||
Structure: |
|
PlayerDecalDigitalSignature
Name: | PlayerDecalDigitalSignature | |||
Structure: |
|
XRankGet
Note: Get ELO Rank Value from Client
Name: | XRankGet | ||||||
Structure: |
|
XRankUpd
Note: Update ELO Rank Value on Client
Name: | XRankUpd | |||||||||
Structure: |
|
CallVoteFailed
Name: | CallVoteFailed | ||||||
Structure: |
|
VoteStart
Name: | VoteStart | ||||||||||||||||||||||||
Structure: |
|
VotePass
Name: | VotePass | ||||||||||||
Structure: |
|
VoteFailed
Name: | VoteFailed | ||||||
Structure: |
|
VoteSetup
Name: | VoteSetup | |||
Structure: |
|
SendLastKillerDamageToClient
Name: | SendLastKillerDamageToClient | ||||||||||||
Structure: |
|
ServerRankUpdate
Name: | ServerRankUpdate.RankUpdate | ||||||||||||||||||
Structure: |
|
Name: | ServerRankUpdate | |||
Structure: |
|
XpUpdate
Name: | XpUpdate | |||
Structure: |
|
ItemPickup
Name: | ItemPickup | |||
Structure: |
|
ShowMenu
Note: show hud menu
Name: | ShowMenu | |||||||||
Structure: |
|
BarTime
Note: For the C4 progress bar
Name: | BarTime | |||
Structure: |
|
AmmoDenied
Name: | AmmoDenied | |||
Structure: |
|
MarkAchievement
Name: | MarkAchievement | |||
Structure: |
|
MatchStatsUpdate
Name: | MatchStatsUpdate | |||
Structure: |
|
ItemDrop
Name: | ItemDrop | ||||||
Structure: |
|
GlowPropTurnOff
Name: | GlowPropTurnOff | |||
Structure: |
|
RoundBackupFilenames
Name: | RoundBackupFilenames | ||||||||||||
Structure: |
|
SSUI
Name: | SSUI | |||||||||
Structure: |
|
SurvivalStats
Name: | SurvivalStats.Fact | ||||||||||||
Structure: |
|
Name: | SurvivalStats.Placement | |||||||||
Structure: |
|
Name: | SurvivalStats.Damage | |||||||||||||||
Structure: |
|
Name: | SurvivalStats | |||||||||||||||
Structure: |
|
EndOfMatchAllPlayersData
Name: | EndOfMatchAllPlayersData.Accolade | |||||||||
Structure: |
|
Name: | EndOfMatchAllPlayersData.PlayerData | ||||||||||||||||||||||||
Structure: |
|
Name: | EndOfMatchAllPlayersData | ||||||
Structure: |
|
RoundImpactScoreData
Name: | RoundImpactScoreData.RisEvent.Victim | ||||||||||||||||||
Structure: |
|
Name: | RoundImpactScoreData.RisEvent.Objective | |||
Structure: |
|
Name: | RoundImpactScoreData.RisEvent.Damage | ||||||||||||||||||
Structure: |
|
Name: | RoundImpactScoreData.RisEvent | |||||||||||||||||||||
Structure: |
|
Name: | RoundImpactScoreData.InitialConditions | |||||||||
Structure: |
|
Name: | RoundImpactScoreData | ||||||
Structure: |
|
CurrentRoundOdds
Name: | CurrentRoundOdds | |||
Structure: |
|
DeepStats
Name: | DeepStats | |||
Structure: |
|
ResetHud
Name: | ResetHud | |||
Structure: |
|
GameTitle
Name: | GameTitle | |||
Structure: |
|
RequestState
Name: | RequestState | |||
Structure: |
|
StopSpectatorMode
Name: | StopSpectatorMode | |||
Structure: |
|
DisconnectToLobby
Name: | DisconnectToLobby | |||
Structure: |
|
WarmupHasEnded
Name: | WarmupHasEnded | |||
Structure: |
|
ClientInfo
Name: | ClientInfo | |||
Structure: |
|
ServerRankRevealAll
Name: | ServerRankRevealAll | ||||||
Structure: |
|