LoadPak: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|Loads a .pak file.}} {{FuncSyntax|LoadPak(PakName, RootPath, ContentPath)}} {{FuncParameters}} {{FuncParam|PakName|The name o...")
(No difference)

Revision as of 18:47, 29 August 2019

LoadPak

Type: Function
Context: Client
Introduced: v1.0

Description

Loads a .pak file.

Syntax

LoadPak(PakName, RootPath, ContentPath)

Parameters

  • PakName
    The name of the Pak file without extension.
  • RootPath
    Root name of your content path. For example /TestDLC/
  • ContentPath
    The full path to bind the root path to. For example: ../../../TestProject/Plugins/TestDLC/Content/

Return Value

  • Returns true on success. Start the client with the "-dev" parameter switch to enable logging. Useful for errors.

Example

function OnPackageStart()
	local pakname = "TestDLC"
	local res = LoadPak(pakname, "/TestDLC/", "../../../TestProject/Plugins/TestDLC/Content/")
	AddPlayerChat("Loading of "..pakname..": "..tostring(res))

	res = ReplaceObjectModelMesh(42, "/TestDLC/Meshes/SM_Chair")
	AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res))
end
AddEvent("OnPackageStart", OnPackageStart)

See also

__EDIT_ME__