LoadPak: Difference between revisions

From Onset Developer Wiki
No edit summary
28days (talk | contribs)
No edit summary
Line 26: Line 26:


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{Template:PakFunctions}}

Revision as of 17:09, 13 December 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 /TestMod/
  • ContentPath
    The full path to bind the root path to. For example: ../../../TestProject/Plugins/TestMod/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 = "TestMod"
	local res = LoadPak(pakname, "/TestMod/", "../../../TestProject/Plugins/TestMod/Content/")
	AddPlayerChat("Loading of "..pakname..": "..tostring(res))

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

See also

Template:PakFunctions