StopPackage: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|Stops a package during runtime. If a client downloads files from it, the download will be cancelled.}} {{FuncSyntax|StopPackag..." |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
{{FuncDescription|Stops a package during runtime. If a client downloads files from it, the download will be cancelled.}} | {{FuncDescription|Stops a package during runtime. If a client downloads files from it, the download will be cancelled.}} | ||
{{FuncSyntax|StopPackage(PackageName)}} | {{FuncSyntax|StopPackage(PackageName, Message)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|PackageName|The name of the package.}} | {{FuncParam|PackageName|The name of the package.}} | ||
{{FuncParamOptional|Message|Reason to print in the log for the unload.}} | |||
{{FuncReturnValue|Returns '''true''' on success.}} | {{FuncReturnValue|Returns '''true''' on success.}} | ||
== 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 22:15, 17 May 2021
Description
Stops a package during runtime. If a client downloads files from it, the download will be cancelled.
Syntax
StopPackage(PackageName, Message)
Parameters
- PackageName
The name of the package. - Message (optional)
Reason to print in the log for the unload.
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)