-
-
Notifications
You must be signed in to change notification settings - Fork 17
Hooks
Prop Hunt: X also have additional hooks to provide more flexibility when customizing the gamemode.
Realm Legend:
šµ Server
š Client
Realm: š Client
Usage: Used to add new Selection Button on Screen Splash menu (F1 Menu)
Args:
- tbl
HelpButton
: table containing information to add button for painting. See example below.
Example:
hook.Add("PH_AddSplashHelpButton", "ButtonHelpTest", function(helpwnd)
local help = helpwnd:AddSelectButton("A Button", function()
chat.AddText(Color(255,255,255), "You pressed the Test button. Congrats!")
end)
-- Add the background colour
help.m_colBackground = Color(255,255,0)
end)
Realm: š Client
Usage: Almost indentical to PH_CustomTabMenu
, but this only visible when 'Player Model' feature is disabled and can be used to override something.
Args:
- DPanel
Panel
: A panel that should parented to/should get properties from. - DGrid
GridPanel
: A grid panel that you wish to use. Ignore this if you want to customise another. - function callback
pVgui
: A callback that similar toPH_CustomTabMenu
's callback.
convar: console command to be run
VGUIType: the vgui type to be created. Available type: check, label, spacer, btn, slider, mute (do not use)
DataType: Font=false = Font Name override
Panel: Default = DGrid Panel or use custom any panel.
Text: Label text only used for slider, label and check.
Note: A Panel created will be visible if parented by DGrid panel. If you tend to make another panel, override by creating a newer (any) panel instead.
Example:
hook.Add("PH_CustomPlayermdlButton", "PHX_OverrideToDonatorPanel", function( Panel, GridPanel, pVgui )
-- Using old technique here still works.
-- We will ignore GridPanel and pVgui as we only demonstrate when the PlayerModel tab is disabled.
local button = vgui.Create("DButton", Panel)
button:SetPos(10, 20)
button:SetSize(50, 32)
button:SetText("Open Donator Model")
button.DoClick = function()
LocalPlayer():ConCommand('my_donator_mdl_cmd')
end
local label = vgui.Create("DLabel", Panel)
-- your advanced label properties here...
end)
TODO: More client side UI Hooks here ā WARNING: Some client Menu UI Hooks may become deprecated on next update.
Realm: šµ Server
Usage: Called when Devil Crystal has been picked up by Props.
Args:
- player
Ply
: Player who picks up the Devil Crystal. Usually Props.
Example:
hook.Add( "PH_OnDevilBallPickup", "PHX_CrystalHasTaken", function( ply )
print( "Player " .. ply:Nick() .. " just picked up a Devil Crystal!" )
end )
Realm: šµ Server
Usage: Called when Lucky Balls has been picked up by Hunters.
Args:
- player
Ply
: Player who picks up the Lucky Balls. Usually Hunters.
Example:
hook.Add( "PH_OnLuckyBallPickup", "PHX_BallsHasTaken", function( ply )
print( "Player " .. ply:Nick() .. " just took a Lucky Ball!" )
end )
Realm: šµ Server
Usage: Override or Adds Hunter's Weapon Loadout
Args:
- player
Ply
: Player whose are Hunter
Example: https://github.com/Wolvin-NET/prophuntx/wiki/Adding-Custom-Weapon
Realm: šµ Server
Usage: Called when Decoy prop has been destroyed by Hunters.
Args:
- player
Attacker
: Attacker who destroy/kills the Decoy.
Realm: šµ Server
Usage: Called when the actual Prop Player has been killed. Attacker can be Hunters or other Entities!
Args:
- player
Victim
: Victim (Props) player. This was required for Pointshop2. - Entity
Inflictor
: Damage Inflictor in Entity. This was required for Pointshop2. - Entity
Attacker
: The Attacker, can be any entity or Hunter player.
Example:
hook.Add("PH_OnPropKilled", "WhenPropWasKilled", function(victim, inflictor, attacker)
-- make sure that the attacker should be a PLAYER.
-- otherwise the attacker will return as WorldSpawn (example: Suicide or Killed by Gravity) or any other Entities.
-- A hunter spotted a prop and kills them.
if IsValid(attacker) && attacker:IsPlayer() then
print("Prop ".. victim:Nick() .. " was found and killed by " .. attacker:Nick())
-- prints a message when the props is killed by gravity or something.
elseif IsValid(attacker) then
print("Prop ".. victim:Nick() .. " was killed by gravity or something (" .. attacker:GetClass() .. ")")
-- when prop suicide.
elseif victim == attacker then
print("Prop ".. victim:Nick() .. " was suicided.")
end
end)
Realm: šµ Server
Usage: Called when Last Prop Standing (LPS) is triggered.
Args:
- player
Stander
: The Last Prop Standing Player Entity. - string
WeaponName
: The Weapon Name that is currently using. Default is using lowercase characters. - tbl
WeaponData
: Table containing weapon information that currently being used by Last Prop Stander. Something that you might want to modify it's value or rather change something else.
Realm: šµ Server
Usage: Called when Prop has Changed it's Prop (Disguise)
Args:
- player
PlayerProp
: Player Prop who just changed their prop appearance. - Entity
Entity
: What entity that prop +USED/Disguised from.
Example:
hook.Add("PH_OnChangeProp", "PHX_InformPropChangeStuff", function( ply, ent )
-- Get the Prop's Old Model
local OldModel = ply:GetPlayerPropEntity():GetModel()
ply:ChatPrint( "Old Prop Model was " .. OldModel )
-- Get the New Model where prop is about to change
local Model = ent:GetModel()
local Class = ent:GetClass()
ply:ChatPrint( "You just changed to '" .. Model .. "' from entity: " .. Class )
end)
Realm: šµ Server
Usage: Called when round is Draw.
Args:
- N/A
Realm: šµ Server
Usage: Called when a Team has won.
Args:
- number
TeamID
: Integer number of Team ID. 1 for Hunters, 2 for Props.
Realm: šµ Server
Usage: Called when hunter was dead after hitting so many non-player props.
Args:
- player
Hunter
: A victim (Hunter) player.
Realm: šµ Server
Usage: Called when Hunter Blindfold time is over. (Usually in 30 seconds mark)
Args:
- N/A
Realm: šµ Server
Usage: Called when the Round Timer has ended. This will result prop always win!
Args:
- N/A
Realm: šµ Server
Usage: Called Before the Round Starts.
Args:
- number
RoundNumber
: Wether or not the Swap is Enabled. ā¹ Revision 19.01.24: Changed to actual Round Number. - boolean `SwapActive: ā¹ Added on Revision 19.01.24: Wether or not Swap Team is Enabled, as an Indicator.
Realm: šµ Server
Usage: Called Before the round ends with Current Round number.
ā¹ It's recommended to use PH_RoundEnd
rather than using PH_OnRoundEnd
if you're know what you're doing.
Args:
- number
num
: Round Number that currently active.
Example:
hook.Add("PH_OnRoundEnd", "PH_GiveSomethingWhenRound9", function( num )
if num == 8 then
for _,v in ipairs( player.GetAll() ) do
-- We will give a 100 points PointShop (if Installed) for a player who have 5 frags on their score.
if (PS) and (v.PS_GivePoints) and v:Frags() >= 5 then
v:PS_GivePoints( 100 )
v:ChatPrints( "You just received 100 Points for your PointShop!" )
end
end
end
end)
Realm: šµ Server
Usage: Called when the round Starts.
Args:
- N/A
Realm: šµ Server
Usage: Called after the round starts (Post).
Args:
- number
RoundNumber
: Current Active Round number
Realm: šµ Server
Usage: Called when Round Ends resulting with Team ID and Team Text (in Translation ID format)
Args:
- number
ID
: Team ID Result - string
TransID
: Team in Translation ID (e.g:HUD_LOSE
orHUD_TEAMWIN
)
Example:
hook.Add("PH_RoundEndResult", "TheEndResults", function( ID, TransID )
if ID == 1001 then
print( PHX:FTranslate( TransID ) ) -- this will print "Draw, Everyone Loses!"
elseif ID == TEAM_PROPS or ID == TEAM_HUNTERS then
print( PHX:FTranslate( TransID, ID ) ) -- this will print something like 'Props Win!' or 'Hunters Win!'
end
end)
Realm: šµ Server
Usage: Called when proper Round Ends.
Args:
- N/A
Realm: šµ Server
Usage: Called when PH:X Fretta's MapVote has been called. This only works if ConVar ph_enable_mapvote
is set to 0
to use another Map Vote system.
Args:
- N/A
Example:
hook.Add("PH_OverrideMapVote", "CustomMapVoteCall", function()
EpicMapvote.StartVoting() -- A mockup example if you have any other mapvote addons.
end)
Use this if there are any new hooks.
Realm: šµ Server / š Client
Usage: Description Here
Args:
- class
Name
: Description
Example:
-- Example Here
Help & Interface
Customization
- Adding Custom Taunts
- Adding Custom Weapons
- ConVars & Console Commands
- Team Options & BlindTime Respawn
- Custom Map Voting
Known Issues
Developer