Server-side Module PlayX

Function Summary

static GetHostURL()
Gets the URL of the host file.
static GetInstance(ply)
Gets the player instance entity.
static GetInstances()
Gets a list of instances.
static GetJWURL()
Gets the URL of the JW player.
static GetProvider(id)
Gets a provider by name.
static GetSubscribed(ply)
Gets a list of instances that a player has subscribed to.
static IsPermitted(ply, instance)
Returns whether a player is permitted to use the player.
static IsUsingJW()
Checks whether the JW player is enabled.
static JWPlayerSupportsYouTube()
Returns whether the JW player supports YouTube.
static PlayerExists()
Checks if a player instance exists in the game.
static ResolveProvider(provider, uri, useJW)
Resolves a provider to a handler.
static SendError(ply, err)
Send the PlayXEnd umsg to clients.
static SendSpawnDialog(ply, forRepeater)
Send the PlayXSpawnDialog umsg to a client, telling the client to open the spawn dialog.
static SendUpdateInfo(ply, ver)
Send the PlayXUpdateInfo umsg to a user.
static SpawnForPlayer(ply, model, repeater)
Spawns the player at the location that a player is looking at.
static SubscribeOnly(ply, instance)
Subscribe a user to only one instance.
static UnsubscribeAll(ply)
Unsubscribes a user from all players.

Functions

GetHostURL

PlayX.GetHostURL()

Gets the URL of the host file. @return


GetInstance

PlayX.GetInstance(ply)

Gets the player instance entity. When there are multiple instances out, default behavior is to get the closest one to the player (if a player is provided). If no player is provided, the behavior is undefined. A hook named PlayXSelectInstance can be -- defined to return a specific entity. This function may return nil. An error message can be returned to indicate why an instance could not be found.

Parameters:

  • ply - Player that can be passed to specify a user

Return values:

  1. Entity or nil
  2. Error message (optional)

GetInstances

PlayX.GetInstances()

Gets a list of instances.

Return value:

  • List of entities

GetJWURL

PlayX.GetJWURL()

Gets the URL of the JW player. @return


GetProvider

PlayX.GetProvider(id)

Gets a provider by name.

Parameters:

  • id - ID of provider

Return value:

  • Provider function or nil

GetSubscribed

PlayX.GetSubscribed(ply)

Gets a list of instances that a player has subscribed to.

Parameters:

  • ply

Return value:

  • List of entities

IsPermitted

PlayX.IsPermitted(ply, instance)

Returns whether a player is permitted to use the player. The PlayXIsPermitted hook allows this function to be overridden.

Parameters:

  • ply - Player
  • instance - Instance to check against (may be nil) @return

IsUsingJW

PlayX.IsUsingJW()

Checks whether the JW player is enabled.

Return value:

  • Whether the JW player is enabled

JWPlayerSupportsYouTube

PlayX.JWPlayerSupportsYouTube()

Returns whether the JW player supports YouTube. @return


PlayerExists

PlayX.PlayerExists()

Checks if a player instance exists in the game.

Return value:

  • Whether a player exists

ResolveProvider

PlayX.ResolveProvider(provider, uri, useJW)

Resolves a provider to a handler.

Parameters:

  • provider - Name of provider, leave blank to auto-detect
  • uri - URI to play
  • useJW - True to allow the use of the JW player, false for otherwise, nil to default true

Return values:

  1. Provider name (detected) or nil
  2. Result or error message

SendError

PlayX.SendError(ply, err)

Send the PlayXEnd umsg to clients. You should not have much of a a reason to call this method.

Parameters:

  • ply
  • err

SendSpawnDialog

PlayX.SendSpawnDialog(ply, forRepeater)

Send the PlayXSpawnDialog umsg to a client, telling the client to open the spawn dialog.

Parameters:

  • ply - Player to send to
  • forRepeater - True if this is for the repeater

SendUpdateInfo

PlayX.SendUpdateInfo(ply, ver)

Send the PlayXUpdateInfo umsg to a user.

Parameters:

  • ply
  • ver

SpawnForPlayer

PlayX.SpawnForPlayer(ply, model, repeater)

Spawns the player at the location that a player is looking at. This function will check whether there is already a player or not.

Parameters:

  • ply - Player
  • model - Model path
  • repeater - Spawn repeater

Return value:

  • Success, and error message

SubscribeOnly

PlayX.SubscribeOnly(ply, instance)

Subscribe a user to only one instance. The user will be unsubscribed from all other players. If the user is already only subscribed to the instance, then nothing will happen.

Parameters:

  • ply - Player
  • instance - Instance to subscribe to

UnsubscribeAll

PlayX.UnsubscribeAll(ply)

Unsubscribes a user from all players.

Parameters:

  • ply - Player