gamemode.Call

From Garry's Mod
Jump to: navigation, search
 gamemode.Call( )

Contents

Description

Called by the engine to call a hook within the loaded gamemode.

The supplied event 'name' must be defined in the active gamemode. Otherwise, nothing will happen - not even hooks added with hook.Add will be called.

This is similar to hook.Run and hook.Call, except the hook library will call hooks created with hook.Add even if there is no corresponding gamemode function.

Arguments

string name

The name of the hook to call.

Arguments

vararg args

The arguments

Returns

any

The result of the hook function - can be up to 6 values. Returns false if the gamemode function doesn't exist (i.e. nothing happened), but remember - a hook can also return false.

Examples

Example

Shows a suicide death notice in Sandbox.

local ply = Entity(1)
gamemode.Call( "AddDeathNotice", ply:GetName(), ply:Team(), nil, ply:GetName(), ply:Team() )

Output:

suidcide death notice.jpg
Personal tools
Navigation