StartPackage: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|Start a package during runtime. If the package contains client files, they will be downloaded during the game.}} {{FuncSyntax|..." |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Starts a package at runtime. The game will automatically handle downloads for new client files. | ||
Notice: [[StartPackage]] will first look into the '''autostart''' folder before looking in the '''packages''' folder.}} | |||
{{FuncSyntax|StartPackage(PackageName)}} | {{FuncSyntax|StartPackage(PackageName)}} | ||
Line 11: | Line 13: | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
function cmd_restartpack(player, package_) | |||
StopPackage(package_) | |||
Delay(500, function() | |||
StartPackage(package_) | |||
end) | |||
end | |||
AddCommand("restartpack", cmd_restartpack) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
*[[ImportPackage]] | |||
*[[StartPackage]] | |||
*[[StopPackage]] | |||
*[[GetAllPackages]] | |||
*[[GetPackageName]] | |||
*[[IsPackageStarted]] |
Latest revision as of 12:14, 11 January 2021
Description
Starts a package at runtime. The game will automatically handle downloads for new client files.
Notice: StartPackage will first look into the autostart folder before looking in the packages folder.
Syntax
StartPackage(PackageName)
Parameters
- PackageName
The name of the package.
Return Value
- Returns true on success.
Example
function cmd_restartpack(player, package_)
StopPackage(package_)
Delay(500, function()
StartPackage(package_)
end)
end
AddCommand("restartpack", cmd_restartpack)