Scripting/Server/Functions/LoadScript
(v0.4.6+) Loads Scripts/<Folder>/Script.xml while the server runs, like a folder of LU/content.xml: its server scripts run, its custom models, client scripts, sprites and sounds are registered. A folder with server scripts only is loaded seamlessly. A folder with content that players download (custom models, client scripts, sprites, sounds) sends everybody back to the join screen, so they get the download window again and rejoin. Event handlers add to the ones already there (every handler runs). A onScriptLoad defined by the new folder runs once. Returns false when the folder does not exist or is already loaded. Console: load_script <folder>.
Syntax
LoadScript("Folder")Arguments
- any "Folder"
Returns
bool
Example
function onPlayerCommand( player, cmd, params )
{
if ( cmd == "loadscript" )
{
local result = LoadScript( 0 );
MessagePlayer( "LoadScript returned: " + result, player );
}
}This sample was generated from the signature – adapt the values to your gamemode.
Related pages
- SetServerName
- SetPassword
- SetServerRule
- RemoveBuildingForPlayer
- SyncPlayerSkins
- ReloadScripts
- UnloadScript
- GetScripts
- ToggleRagdollPhysics
- ToggleVehicleDents
- LoadModule
- GetTickCount
Section: Server information and administration