Difference between revisions of "Engine.StopResource"
Jump to navigation
Jump to search
(Created page with "== Function == <syntaxhighlight lang="javascript"> function Engine.StopResource(resourceName); </syntaxhighlight> === Arguments === * resourceName ** The name of the resour...") |
|||
Line 17: | Line 17: | ||
This function doesn't return any arguments. | This function doesn't return any arguments. | ||
+ | |||
+ | === Example === | ||
+ | |||
+ | <syntaxhighlight lang="javascript"> | ||
+ | |||
+ | // Add a handler for "stop" to that we can stop a resource using the chatbox. | ||
+ | // It would be a good idea to check if the user is allowed to do so when possible. | ||
+ | // It would also be a good idea to check the number of arguments in the array to prevent errors. | ||
+ | // | ||
+ | Engine.AddCommandHandler("stop",function(player, commandLine, command, arguments){ | ||
+ | Engine.StopResource(arguments[0]); | ||
+ | }); | ||
+ | |||
+ | </syntaxhighlight> | ||
== Notes == | == Notes == | ||
If the resource doesn't exist then an error is thrown. | If the resource doesn't exist then an error is thrown. |
Latest revision as of 07:00, 12 August 2014
Function
function Engine.StopResource(resourceName);
Arguments
- resourceName
- The name of the resource to stop.
Description
This function will stop the resource.
Returns
This function doesn't return any arguments.
Example
// Add a handler for "stop" to that we can stop a resource using the chatbox.
// It would be a good idea to check if the user is allowed to do so when possible.
// It would also be a good idea to check the number of arguments in the array to prevent errors.
//
Engine.AddCommandHandler("stop",function(player, commandLine, command, arguments){
Engine.StopResource(arguments[0]);
});
Notes
If the resource doesn't exist then an error is thrown.