Left 4 Dead 2 Guide

VSLib Developer Guide - Notifications

Sharing is temporarily disabled

Left 4 Dead 2 Guide

Notifications

Notifications are an important portion of VSLib. Your First VSLib Mutation explains how to use notifications. Here is an example notification:
function Notifications::NameOfTheNotification::YourFunctionName ( a list of game event arguments, params )
Above, we have an example notification prototype. NameOfTheNotification is the notification that you are requesting. YourFunctionName is a simple description (that can be anything) of what the function will do. Params is the original table that OnGameEvent passes. Almost every VSLib notification will pass a params argument.

Below, you will find a list of all available notifications. Search this page for whatever your looking for (e.g. tank for tank notifications).

List of Available Notifications and Their Descriptions

function Notifications::OnHurt::YourFunctionName ( entity, attacker, params )

This notification is fired every time a player is hurt. VSLib will return the Player entity that was hurt and the attacker.



function Notifications::OnAwarded::YourFunctionName ( player, subjectid, award, params )

Whenever an award event occurs in the game (such as a player protects another player, revives another player, heals another player, etc.), this notification will fire. Player is the player who got the award, subjectid is the entity index that belongs to the other party of the award (you can pass the index into a VSLib Player class to get the player), and award is an integer that defines the award that was earned. You can find out what award does what via trial and error. The VSLib Player class includes a HasAward function too.



function Notifications::OnDoorClosed::YourFunctionName ( player, checkpoint, params )

Fires when a door is closed. Returns the player who closed the door and whether or not the door was a saferoom/checkpoint door (boolean).



function Notifications::OnDoorOpened::YourFunctionName ( player, checkpoint, params )

Fires when a door is opened. Returns the player who opened the door and whether or not the door was a saferoom/checkpoint door (boolean).



function Notifications::OnRescueVehicleReady::YourFunctionName ( campaign, params )

Fires when the rescue vehicle is ready, passing the campaign name string to you.



function Notifications::OnRescueVehicleLeaving::YourFunctionName ( survivorCount, params )

Fires when the rescue vehicle leaves, passing the total number of round survivors.



function Notifications::OnFinaleWin::YourFunctionName ( mapName, difficulty, params )

Fired when the finale is won. Passes the map name (string) and difficulty (integer).



function Notifications::OnRoundStart::YourFunctionName ( params )

Fired when the round begins (e.g. map finishes loading or the survivors and infected switch to begin a new round).



function Notifications::OnRoundEnd::YourFunctionName ( winner, reason, message, time, params )

Fired when the round is finished, passing on the winning team integer (e.g. SURVIVORS or INFECTED), reason why they won (integer), a round end message (string), and the time the round was in session (float).



function Notifications::OnPlayerJoined::YourFunctionName ( player, name, IPAddress, SteamID, params )

Fired when a player connects to the server.



function Notifications::OnNameChanged::YourFunctionName ( player, oldName, newName, params )

Fired when a player changes his/her Steam name while in-game.



function Notifications::OnDeath::YourFunctionName ( victim, attacker, params )

Fired when a player dies.



function Notifications::OnDefibSuccess::YourFunctionName ( player, reviver, params )

Fired when a person is successfully defibrillated.



function Notifications::OnEnterSaferoom::YourFunctionName ( player, params )

Called when a player enters the ending saferoom.



function Notifications::OnLeaveSaferoom::YourFunctionName ( player, params )

Called when a player leaves the ending saferoom.



function Notifications::OnJump::YourFunctionName ( player, params )

Fired when a player jumps.



function Notifications::OnSpawn::YourFunctionName ( player, params )

Fires when a player spawns.



function Notifications::OnFirstSpawn::YourFunctionName ( player, params )

Fired when a player spawns for the first time in the round.



function Notifications::OnShoved::YourFunctionName ( victim, attacker, params )

Fired when a player melees another player.



function Notifications::OnUse::YourFunctionName ( player, targetid, params )

Fires when a player attempts to "use" another object (e.g. E key). The targetid can be passed into a VSLib Entity instance.



function Notifications::OnTeamChanged::YourFunctionName ( player, oldTeam, newTeam, params )

Fires when a player switches teams. SURVIVORS and INFECTED can be used to compare.



function Notifications::OnAbilityUsed::YourFunctionName ( player, ability, params )

Fired when an infected player uses his/her ability (string). E.g. "ability_lunge" or "ability_tongue" or "ability_vomit" or "ability_charge" or "ability_spit" or "ability_ride"



function Notifications::OnPanicEvent::YourFunctionName ( player, params )

Fired when a panic event is caused. The player who caused the panic event is passed to you.



function Notifications::OnInfectedHurt::YourFunctionName ( victim, attacker, params )

Fired when an infected is hurt (like common or special infected). Note that OnHurt also fires for special infected (and survivors), but not common infected.



function Notifications::OnWitchStartled::YourFunctionName ( witchid, player, params )

Fired when a witch is startled. The witchid is passed along with the player who startled the witch. You can pass the witchid into a VSLib Entity instance.



function Notifications::OnWitchKilled::YourFunctionName ( witchid, player, params )

Fired when a witch is killed. The witchid can be passed into a VSLib entity instance. The player is the person who killed the witch.



function Notifications::OnZombieIgnited::YourFunctionName ( victim, attacker, params )

Fired when a zombie is ignited either with moltovs or incendiary ammo or whatever.



function Notifications::OnAdrenalineUsed::YourFunctionName ( player, params )

Fired when a player uses adrenaline.



function Notifications::OnHealStart::YourFunctionName ( player, healer, params )

Fired when a player begins to bandage another player.



function Notifications::OnHealEnd::YourFunctionName ( player, healer, params )

Fired when a heal ends for whatever reason (e.g. infected get in the way or they stopped healing or they finished healing or whatever).



function Notifications::OnHealSuccess::YourFunctionName ( player, healer, health, params )

Fired when a heal is successful. Health is an integer that contains how much health was restored.



function Notifications::OnPillsUsed::YourFunctionName ( player, params )

Fired when a survivor uses pills.



function Notifications::OnIncapacitated::YourFunctionName ( victim, attacker, params )

Fired when a survivor gets incapacitated. Sometimes can fire for tanks, but not usually.



function Notifications::FirstSurvLeftStartArea::YourFunctionName ( player, params )

Fires when a survivor leaves the start area, passing the first player who left the start area. Note that this function only seems to fire once per round. If all the players die and respawn (in coop for example), it won't fire again when a survivor leaves the start area. Valve bug? Who knows.



function Notifications::OnSurvivorsLeftStartArea::YourFunctionName ( )

Fired when a survivor leaves the start area for the first time. This is basically VSLib's solution to the FirstSurvLeftStartArea problem. Although it doesn't pass the player who left the start area, you can find out by checking which survivor's flow is the greatest in this function.



function Notifications::OnReviveBegin::YourFunctionName ( player, reviver, params )

Fired when the revive process begins.



function Notifications::OnReviveEnd::YourFunctionName ( player, reviver, params )

Fired when the revive process ends for whatever reason.



function Notifications::OnReviveSuccess::YourFunctionName ( player, reviver, params )

Fired when a survivor is successfully revived from incapacitation.



function Notifications::OnWeaponGiven::YourFunctionName ( receiver, giver, params )

Fired when a player shares his/her weapon with another player. This may include pills, adrenaline shots, etc.



function Notifications::OnWeaponReload::YourFunctionName ( player, manual, params )

Fired whenever a player reloads his/her weapon. The second argument is a boolean value indicating whether the player manually reloaded (e.g. pressed the R key) or whether the engine auto-reloaded after the player emptied the clip.



function Notifications::OnWeaponZoom::YourFunctionName ( player, params )

Fired when the player zooms in using their weapon.



function Notifications::OnChargerCharged::YourFunctionName ( charger, params )

Fired when a Charger charges.



function Notifications::OnChargerCarryVictim::YourFunctionName ( charger, victim, params )

Fired when the charger grabs a victim while charging.



function Notifications::OnChargerImpact::YourFunctionName ( charger, victim, params )

Fired every time the charger smashes the player on the ground during its attack. It could also be caused by a charge run impact (e.g. other survivors getting tossed away).



function Notifications::OnChargerPummelBegin::YourFunctionName ( charger, victim, params )

When it stops charging and begins to smash its victim onto the ground.



function Notifications::OnChargerPummelEnd::YourFunctionName ( charger, victim, params )

When the charger is killed OR the charger kills its victim while pummeling.



function Notifications::OnSmokerChokeBegin::YourFunctionName ( smoker, victim, params )

When a smoker begins choking its victim.



function Notifications::OnSmokerChokeStopped::YourFunctionName ( smoker, victim, savior, params )

Fired when a smoker is stopped. Savior is the player who killed the smoker. This could also fire if the smoker manages to kill the victim, in which case there would be no valid savior (check the IsPlayerEntityValid() for savior before you use it).



function Notifications::OnSmokerChokeEnd::YourFunctionName ( smoker, victim, params )

Fired when the smoker finishes choking, either because the victim died or because the smoker died.



function Notifications::OnSmokerTongueReleased::YourFunctionName ( smoker, victim, params )

Fired when the smoker loses its tongue (and thus its grasp of the survivor).



function Notifications::OnEnterSpit::YourFunctionName ( player, params )

Fired when a player enters Spitter spit.



function Notifications::OnJockeyRideStart::YourFunctionName ( jockey, victim, params )

Fired when a jockey begins riding a victim.



function Notifications::OnJockeyRideEnd::YourFunctionName ( jockey, victim, params )

Fired when a jockey stops riding its victim.



function Notifications::OnHunterPouncedVictim::YourFunctionName ( hunter, victim, params )

Fired when a hunter lunges and pounces on a victim.



function Notifications::OnHunterReleasedVictim::YourFunctionName ( hunter, victim, params )

Fired when the hunter releases its victim.



function Notifications::OnPlayerVomited::YourFunctionName ( victim, boomer, params )

Fired when a boomer vomits on a survivor.



function Notifications::OnTankPissed::YourFunctionName ( tank, params )

Fired when the tank becomes frustrated.



function Notifications::OnTankKilled::YourFunctionName ( tank, attacker, params )

Fired when a tank is killed.



function Notifications::OnTankSpawned::YourFunctionName ( tank, params )

Fired when a tank spawns.



function Notifications::OnDifficulty::YourFunctionName ( difficulty )

Called once when the round starts and called every time the difficulty changes; outputs the difficulty.

Difficulty: EASY, NORMAL, ADVANCED, EXPERT

Tagged

Community Tags

  • VSLib

Guide Credits

You may like

  • Mod
    Guns+ and SI+
    N/A

    it's a vscripts mod. so, can't be used together with mods that alternate gameplay directly(such as Admin System) but works fine with Weapon Script mods since i didn't use weapon script files Works only on Local Host and Singleplay. Does...

    29,355
  • Mod
    Anti-Trolls System
    N/A

    This mod made to prevent those team killers(aka Trolls) from killing all teammates and abuse vote system >>This mod is using vscripts. so it can not be used together with any other mods of mine or Vscripts driven mods. Such as Admin Syst...

    7,416
  • Mod
    Insanity Worlds
    N/A

    This is a vscripts driven mod Note that this mod doesn't work on any Custom Maps or Official Servers This mod is not mutation. it can runs on every game mode _____________________________________________________________________________...

    14,086
  • Mod
    Augmented Bots
    N/A

    This mod makes bots pretty stronger than vanilla bots Can not use together with other vscripts mods such as Rectus' Custom weapons, Admin System or any other mods of mine Mod Features - Cs weapons are unlocked - Bots have 150 shield po...

    26,126
  • Mod
    Brutal Apocalypse
    N/A

    THIS MOD IS USING A VSLIBs scripts. So it might be collided some Vslibs/Vscripts mods THIS MOD DOES NOT WORK ON CUSTOM CAMPAIGNS. ⋙WARNING!!!!⋘ This mod makes the game much more difficult. if you're easy to upset or play serious, you mig...

    22,206

Feedback