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 edit summary |
||
Line 7: | Line 7: | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|PakName|The name of the Pak file without extension.}} | {{FuncParam|PakName|The name of the Pak file without extension.}} | ||
{{FuncParam|RootPath|Root name of your content path. For example / | {{FuncParam|RootPath|Root name of your content path. For example /TestMod/}} | ||
{{FuncParam|ContentPath|The full path to bind the root path to. For example: ../../../TestProject/Plugins/ | {{FuncParam|ContentPath|The full path to bind the root path to. For example: ../../../TestProject/Plugins/TestMod/Content/}} | ||
{{FuncReturnValue|Returns '''true''' on success. Start the client with the "-dev" parameter switch to enable logging. Useful for errors.}} | {{FuncReturnValue|Returns '''true''' on success. Start the client with the "-dev" parameter switch to enable logging. Useful for errors.}} | ||
Line 15: | Line 15: | ||
<syntaxhighlight lang="Lua"> | <syntaxhighlight lang="Lua"> | ||
function OnPackageStart() | function OnPackageStart() | ||
local pakname = " | local pakname = "TestMod" | ||
local res = LoadPak(pakname, "/ | local res = LoadPak(pakname, "/TestMod/", "../../../TestProject/Plugins/TestMod/Content/") | ||
AddPlayerChat("Loading of "..pakname..": "..tostring(res)) | AddPlayerChat("Loading of "..pakname..": "..tostring(res)) | ||
res = ReplaceObjectModelMesh(42, "/ | res = ReplaceObjectModelMesh(42, "/TestMod/Meshes/SM_Chair") | ||
AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res)) | AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res)) | ||
end | end |
Revision as of 23:36, 6 December 2019
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
__EDIT_ME__