Difference between revisions of "Half-Life 1 Game Events"

From AlliedModders Wiki
Jump to: navigation, search
(Scenario)
(Scenario)
Line 271: Line 271:
 
{{qnotice|If Active is 0, don't send any other arguments afterwards. Also, you don't need to send either short if flashRate is just going to be 0.}}<br>
 
{{qnotice|If Active is 0, don't send any other arguments afterwards. Also, you don't need to send either short if flashRate is just going to be 0.}}<br>
 
[[image:Cs_scenario_msg.jpg|frame|right|Scenario message in CS, using the following parameters: 1, d_mp5navy, 150]]
 
[[image:Cs_scenario_msg.jpg|frame|right|Scenario message in CS, using the following parameters: 1, d_mp5navy, 150]]
{{qnotice|Works in both CS and CZ!}}
+
{{qnotice|Works in both CS and CZ!}}<br>
 +
{{qnotice|In CZ (and possibly CS), if someone respawns after the bomb has been planted, their Scenario event will not work at all until the next round.}}
 
{{begin-hl1msg|Scenario|byte,string,byte,short,short}}
 
{{begin-hl1msg|Scenario|byte,string,byte,short,short}}
 
{{hl1msg|byte|Active}}
 
{{hl1msg|byte|Active}}

Revision as of 13:38, 3 January 2007

Half-Life Events

In Pawn you are able to hook in-game events with register_event. Here are the list of the standard Half-Life 1 and Counter-Strike events and their parameters which can be read with read_data

See the Advanced Scripting article for more on events and messages.

ADStop

Note: No Information available for this event

Name: ADStop
Structure:


AllowSpec

Changes whether or not "SPECTATE" appears on the change team menu. Called whenever the allow_spectators cvar is changed, with its new value sent as the byte.
Note: This changes how the change team menu appears, but spectating functionality is based off of the actual cvar value.

Name: AllowSpec
Structure:
byte Allowed


AmmoPickup

Temporarily draws HUD the ammo amount and ammo type HUD icon in the middle of the right side of the screen.
Note: Draw time is dependent on the hud_drawhistory_time client CVAR value

Name: AmmoPickup
Structure:
byte AmmoID
byte Ammount


AmmoX

Updates green bar indicator in the HUD weapons-list. Also updates HUD backpack ammo number in the lower right corner of the screen in case the given ammo type are compatible with the current weapon.

Name: AmmoX
Structure:
byte AmmoID
byte Ammount


BarTime

Draws a HUD progress bar which is filled from 0% to 100% for the time Duration seconds and then disappeared.
Note: Set Duration to 0 to hide the bar.

Name: BarTime
Structure:
short Duration


BarTime2

The same as BarTime but StartPC is specify how many per cents of the bar are (already) filled.
Note: Display time can be calculated with this formula: (1 - StartPC/100) / Duration

Name: BarTime2
Structure:
short Duration
short StartPC


Battery

Updates the icon and number of the armor on the HUD.

Name: Battery
Structure:
short Armor


BlinkAcct

Makes a player's money display flash rapidly, until it flashes a total of BlinkAmt times.

Name: BlinkAcct
Structure:
byte BlinkAmt


BombDrop

The first three arguments are the origin of the dropped bomb. The last argument is set to 1 if the bomb has been planted. It is 0 if the bomb was dropped due to voluntary dropping or death/disconnect. Setting the last argument 1, will also trigger the round timer to hide. It also will show the dropped bomb on the Terrorist team's radar in the location specified by the first three arguments.

Name: BombDrop
Structure:
coord X
coord Y
coord Z
byte Flag


BombPickup

This message just tells the game that the bomb has been picked up. It will cause the dropped/planted bomb to disappear from the Terrorist team's radar.

Name: BombPickup
Structure:


BotProgress

Used by CZ's bots when learning a new map. Displays a progress bar in the middle of the screen, with some header text. The bar doesn't move, and you can't do anything while the bar is displayed. This is a different style of progress bar than from the BarTime event. This really doesn't display well in CS.
Note: Flag can be 0 (update bar), 1 (create new bar), or 2 (remove bar). When using flag 0, send all arguments. When using flag 1, send only Flag and Header. When using flag 2, send only Flag.

Name: BotProgress
Structure:
byte Flag
byte Progress
string Header


BotVoice

Displays (or hides) the voice icon above a user's head and the talking icon on the right side of the screen. This is called by CZ for bots; it's not called by regular players, although you can specify a regular player (non-bot) for the playerIndex. Status is 1 for talking, or 0 for not talking.

Name: BotVoice
Structure:
byte Status
byte playerIndex


Brass

Creates a brass shell. Used, for example, by the AWP, after firing.

Name: Brass
Structure:
byte Unknown
coord Start X
coord Start Y
coord Start Z
coord Velocity X?
coord Velocity Y?
coord Velocity Z?
coord Unknown X
coord Unknown Y
coord Unknown Z
angle Life?
short Model?
byte Unknown
byte Unknown
byte Unknown


BuyClose

Forces the buy menu to close. This is not called when the player closes the buy menu by himself; it's only called when the game forces him to do so (ie: he walks outside of the buy zone, gets killed, etcetera).

Name: BuyClose
Structure:


ClCorpse

Spawns a player's corpse. Model is the player's model, for example: "leet". Delay is the delay before animation plaback, can be negative value.
Note: The Origin and Delay is in non-standard format.

Name: ClCorpse
Structure:
string Model
long OriginX
long OriginY
long OriginZ
coord AngleX
coord AngleY
coord AngleZ
long Delay
byte Sequence
byte unknown
byte TeamID
byte PlayerID


Crosshair

Draws/removes the crosshair. If Flag is set to 1 the crosshair will be drawn.

Name: Crosshair
Structure:
byte Flag


CurWeapon

Updates the clip ammo number and weapon's corresponding ammo type icon on the HUD.

Name: CurWeapon
Structure:
byte isActive
byte WeaponID
byte ClipAmmo


CZCareer

Supplies certain updates to the player regarding Condition Zero singleplayer missions.
Note: See the CZCareer page for more information.

Note: Using an invalid type has no repercussions whatsoever. Therefore, you can use this to make your own custom communications (you can send any number of arguments of any type after the first string).
Note: The Type argument is case-sensitive.
Note: This event does nothing in CS and CZ multiplayer.

Name: CZCareer
Structure:
string Type
* Parameters


CZCareerHUD

Displays certain HUD elements regarding Condition Zero singleplayer missions.
Note: See the CZCareerHUD page for more information.

Note: Using an invalid type has no repercussions whatsoever. Therefore, you can use this to make your own custom communications (you can send any number of arguments of any type after the first string).
Note: The Type argument is case-sensitive.
Note: This event has some limited functionality in CS and CZ multiplayer (albeit better in CZ).

Name: CZCareerHUD
Structure:
string Type
* Parameters


Damage

Called when a player takes damage, to display the red locational indicators.

Name: Damage
Structure:
byte Damage save (armor)
byte Damage take (health)
long Damage type
coord X
coord Y
coord Z


DeathMsg

Fired to all players (MSG_ALL or MSG_BROADCAST) to notify them of a death. This generates the HUD message the client sees in the upper right corner of their screen.
Also prints the console text message "KillerName killed VictimName with WeaponName" or "*** KillerName killed VictimName with a headshot from WeaponName ***"

Name: DeathMsg
Structure:
byte KillerID
byte VictimID
byte isHeadshot
string WeaponName


FlashBat

Updates the flashlight battery charge on the HUD. ChargePC is in per cents.

Name: FlashBat
Structure:
byte ChargePC


Flashlight

Updates the flashlight state and battery charge on the HUD. If Flag is set to 1 the flashlight HUD icon will be shown as active.

Name: Flashlight
Structure:
byte Flag
byte ChargePC


Fog

Note: No Information available for this event

Name: Fog
Structure:


ForceCam

Called whenever mp_forcecam or mp_forcechasecam are changed, with their new values passed. There is assumedly a third cvar that this tracks, but it is yet unknown. Note that this message doesn't actually change any of the spectating rules for the client.
Note: Even if mp_forcechasecam is set to 2, it is sent by this message as 1.

Name: ForceCam
Structure:
byte forcecamValue
byte forcechasecamValue
byte Unknown


HostageK

Temporary draws a blinking red dot on the CT players' radar when hostage is killed.

Name: HostageK
Structure:
byte HostageID


HostagePos

Draws/updates the blue mark on the CT players' radar which represents the corresponding hostage's position.

Name: HostagePos
Structure:
byte unknown
byte HostageID
coord X
coord Y
coord Z


Money

Updates the Amount of money on the HUD. If the Flag is 1, the additional new-old HUD money amount difference will be also displayed.

Name: Money
Structure:
long Amount
byte Flag


NVGToggle

Toggles night vision mode. For Flag: 1 is on, 0 is off.

Name: NVGToggle
Structure:
byte Flag


ResetHUD

Resets the HUD.

Name: ResetHUD
Structure:


RoundTime

Updates the round timer on the HUD. Time is in seconds.

Name: RoundTime
Structure:
short Time


SayText

Prints say HUD text. Second parameter can be a predefined string or a custom one. In the last case the last two parameters isn't required.
Some values of the predifined string: #Cstrike_Chat_AllDead, #Cstrike_Chat_All

Name: SayText
Structure:
byte SenderID
string String
string unknown
string Text


Scenario

If Active is 0, this display will be hidden. If Active is 1, displays Sprite (valid names listed in sprites/hud.txt) to the right of the round timer with an alpha value of Alpha (100-255). If flashRate is nonzero, then the sprite will flash from given the given alpha to an alpha of 100, at a rate of flashRate (measured in ???). This is used by CZ to display how many hostages remain unrescued, and also to display the ticking bomb when it is planted.
Note: If Active is 0, don't send any other arguments afterwards. Also, you don't need to send either short if flashRate is just going to be 0.

Scenario message in CS, using the following parameters: 1, d_mp5navy, 150

Note: Works in both CS and CZ!
Note: In CZ (and possibly CS), if someone respawns after the bomb has been planted, their Scenario event will not work at all until the next round.

Name: Scenario
Structure:
byte Active
string Sprite
byte Alpha
short flashRate
short Unknown


ScoreAttrib

Updates the scoreboard's attribute for the specified player. For the 2nd argument, 0 is nothing, 1 is dead, 2 is bomb, 4 is VIP.
Note: Flag is a bitwise value so if VIP player dying with the bomb the Flag will be 7

Name: ScoreAttrib
Structure:
byte PlayerID
byte Flag


ShowMenu

Displays a "menu" to a player (text on the left side of the screen). Acts like AMXX's show_menu (in fact, this is how AMXX shows a menu).
Note: Multipart should be 1 if your menu takes up multiple messages (ie: string is too big to fit into one). On the final message, Multipart should be 0.

Name: ShowMenu
Structure:
short Keys
char Time
byte Multipart
string Text


StatusIcon

Draws/removes the specified status HUD icon. For Status, 0 is Hide Icon, 1 is Show Icon, 2 is Flash Icon. Red, Green and Blue arguments is optional and is specified only when Status are not 0.

Name: StatusIcon
Structure:
byte Status
string SpriteName
byte Red
byte Green
byte Blue


StatusText

Specifies the status text format.

Name: StatusText
Structure:
byte unknown
string Text


StatusValue

Sends/updates the status values. For the Flag 1 the Value is TeamRelation, for 2 is PlayerID, for 3 is Health. For TeamRelation, 1 is Teammate player, 2 is Non-Teammate player, 3 is Hostage. If TeamRelation is the Hostage, PlayerID will be always 0.
Note: Usually is fired as a triple message, for example:

 (1, 2) - non-teammate player
(2, 7) - player index is 7
(3, 59) - health is 59
Name: StatusValue
Structure:
byte Flag
short Value


TaskTime

Displays a secondary timer above the round timer. Used for Condition Zero singleplayer missions.
If Time is -1, timer dissappears. If Time is any other negative value, it is displayed as green instead of yellow, and considered positive.
If Active is true, timer counts down. Otherwise, it is paused.
If Fade is above zero, the timer will slowly fade out after that many seconds have passed (even if the timer is inactive).
Note: This event can only be used on missions that have an objective requiring a secondary timer!

Name: TaskTime
Structure:
short Time
byte Active
byte Fade


TeamInfo

TeamName is either "UNASSIGNED", "TERRORIST" or "CT".

Name: TeamInfo
Structure:
byte ID
string TeamName


TeamScore

Updates the team score on the score board. TeamName is either "TERRORIST" or "CT".

Name: TeamScore
Structure:
string TeamName
short Score


TextMsg

Note: There does not necessarily have to be a total of 6 arguments, there could be as little as 2. For example you can send a message with the following:
Arg1: 1
Arg2: #Game_join_ct
Arg3: 4HM

Name: TextMsg
Structure:
byte ID
string Message
string Submsg
string Submsg
string Submsg
string Submsg


Train

Displays the speed bar used for controlling a train.
Note: Speed is as follows: 0 (disable display), 1 (reverse), 2 (neutral), 3 (slow speed), 4 (medium speed), 5 (maximum speed)

Name: Train
Structure:
byte Speed


TutorClose

Closes all CZ-style tutor popups.

Name: TutorClose
Structure:


TutorLine

Note: No Information available for this event

Name: TutorLine
Structure:


TutorState

Note: No Information available for this event

Name: TutorState
Structure:


TutorText

Used to display a CZ-style tutor popup.

Name: TutorText
Structure:
string Unknown
byte Unknown
short Unknown
short Unknown
short Unknown


VGUIMenu

Displays a predefined VGUI menu. Keys is a keys bit sum.

Name: VGUIMenu
Structure:
byte unknown
short Keys
char unknown
byte unknown
string unknown


ViewMode

Note: No Information available for this event (HLSDK says this switches to first-person view, but it doesn't seem to function as so)

Name: ViewMode
Structure:


VoiceMask

Used to tell a client who he can hear over the microphone.

Name: VoiceMask
Structure:
long AudiblePlayersIndexBitSum
long ServerBannedPlayersIndexBitSum


WeapPickup

Fired right before weapon is picked up.
Note: Notice: "right before".

Name: WeapPickup
Structure:
byte WeaponID