Spawns

Hook Documentation for Spawns Module.

Functions

MODULE:CanPlayerCreateChar(client)

Whether or not a player is allowed to create a new character.

Parameters

  • client Player

    Player attempting to create a new character

Returns

  • bool

    Whether or not the player is allowed to create the chacter. This function defaults to true, so you should only ever return false if you're disallowing creation. Othwise, don't return anything as you'll prevent any other calls to this hook from running.

  • string

    Language phrase to use for the error message

  • ...

    Arguments to use for the language phrase

Example Usage

function MODULE:CanPlayerCreateChar(client)
	if (!client:isStaff()) then
		return false, "notNow" -- only allow staff to create a character
	end
end
non-admins will see the message "You are not allowed to do this ght now!"

MODULE:CanPlayerJoinClass(client, class, info)

Whether or not a player is allowed to join a class.

Parameters

  • client Player

    Player attempting to join

  • class Integer

    ID of the class

  • info Table

    The class table

Returns

  • bool

    Whether or not to allow the player to join the class

Example Usage

function MODULE:CanPlayerJoinClass(client, class, info)
	return client:isStaff() -- Restrict joining classes to staff only.
end

MODULE:CanPlayerUseChar(client, character)

Determines whether a player is allowed to use a specific character. This hook can be used to implement custom checks to determine if a player is allowed to use a particular character.

Parameters

  • client Player

    The player attempting to use the character

  • character Character

    The character being considered for use

Returns

  • bool

    Whether the player is allowed to use the character

  • string or nil

    If disallowed, a reason for the disallowance; otherwise, nil

MODULE:CharDeleted(client, character)

Called after a character is deleted.

Parameters

  • client Player

    The player entity.

  • character Character

    The character being deleted.

MODULE:CharHasFlags(character, flags)

Determines if a character has the given flag(s).

Parameters

  • character Character

    The character to check for flags.

  • flags String

    The flag(s) to check access for.

Returns

  • bool

    Whether or not this character has access to the given flag(s).

MODULE:CharLoaded(character)

Called when a character is loaded. This function is called after a character has been successfully loaded.

Parameters

  • character Character

    The character that has been loaded

MODULE:CharPostSave(character)

Called after a character has been saved. This function is called after a character has been successfully saved.

Parameters

  • character Character

    The character that has been saved

MODULE:CharPreSave(character)

Called before a character is saved. This function is called before a character is about to be saved.

Parameters

  • character Character

    The character about to be saved

MODULE:ClassOnLoadout(client)

Called after FactionOnLoadout is executed. This hook is called after a player's class loadout has been applied.

Parameters

  • client Player

    The player entity for whom the class loadout was applied.

MODULE:ClassPostLoadout(client)

Called after FactionPostLoadout is executed. This hook is called after additional actions related to a player's class loadout have been performed.

Parameters

  • client Player

    The player entity for whom the class loadout was applied.

MODULE:FactionOnLoadout(client)

Called after PlayerLoadout is executed. This hook is called after a player's faction loadout has been applied.

Parameters

  • client Player

    The player entity for whom the faction loadout was applied.

MODULE:FactionPostLoadout(client)

Called after PostPlayerLoadout is executed. This hook is called after additional actions related to a player's faction loadout have been performed.

Parameters

  • client Player

    The player entity for whom the faction loadout was applied.

MODULE:GetMaxPlayerChar(client)

Retrieves the maximum number of characters a player can have.

Parameters

  • client Player

    The player for whom to retrieve the maximum number of characters.

Returns

  • int

    The maximum number of characters the player can have.

MODULE:PlayerLoadedChar(client, character, currentChar)

Called when a player's character is loaded.

Parameters

  • client Player

    The player entity.

  • character Character

    The character being loaded.

  • currentChar Character

    The current character of the player.

MODULE:PostCharDelete(client, character)

Called after a character is deleted.

Parameters

  • client Player

    The player entity.

  • character Character

    The character being deleted.

MODULE:PostPlayerLoadedChar(client, character, currentChar)

Called after a player's character is loaded.

Parameters

  • client Player

    The player entity.

  • character Character

    The character being loaded.

  • currentChar Character

    The current character of the player.

MODULE:PostPlayerLoadout(client)

Called after all of the player's loadout hooks are executed (PlayerLoadout, FactionOnLoadout, ClassOnLoadout). This hook is called after a player's loadout has been fully applied, including faction and class loadouts.

Parameters

  • client Player

    The player entity for whom the loadout was applied.

MODULE:PrePlayerLoadedChar(client, character, currentChar)

Called before a player's character is loaded.

Parameters

  • client Player

    The player entity.

  • character Character

    The character being loaded.

  • currentChar Character

    The current character of the player.