Squirrel/Server/Functions/Scripts/LoadScript
From Liberty Unleashed Wiki
(Difference between revisions)
m (Removed link code that should not exist) |
|||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
− | This example will load the scripts specified in Script.xml in | + | This example will load the scripts specified in Script.xml in Scripts/SomeScript when someone types /load. |
<code lang="squirrel"> | <code lang="squirrel"> |
Latest revision as of 04:00, 12 January 2012
This function will load a script folder. Note that the script folder you wish to load should be placed in the Scripts/ folder of your server.
[edit] Syntax
bool LoadScript( string scriptName )
[edit] Arguments
- scriptName - The name of the script folder
[edit] Example
This example will load the scripts specified in Script.xml in Scripts/SomeScript when someone types /load.
function onPlayerCommand( id, cmd, text ) { if ( cmd == "load" ) { LoadScript( "SomeScript" ); Message( "SomeScript loaded!" ); } return 1; }
[edit] Notes
The function Message and call onPlayerCommand were used in in this example. More info about them in corresponding pages.