Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script Loader by H® Shaft
- -- allows you to specify a script to load for a specific map name and game type combination, and unload that script when game is over
- -- Add this script to your sapp init file, when the map and gametype load, the specified script will load as well
- -- sapp api version
- api_version = "1.8.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
- if get_var(0, "$gt") ~= "n/a" then
- load_script()
- end
- end
- function OnScriptUnload() end
- function OnNewGame()
- load_script()
- end
- function load_script()
- local game_mode = get_var(0, "$mode")
- local map_name = get_var(0, "$map")
- if (map_name == "bloodgulch") and (game_mode == "YOUR_GAME_TYPE_HERE") then -- << Enter your MAP NAME ("bloodgulch") and GAME TYPE name ("YOUR_GAME_TYPE_HERE")
- execute_command("lua_load YOUR_SCRIPT_NAME_HERE") -- << Enter your script name to load when game starts. Also, enter this name below to unload it
- end
- end
- function OnGameEnd()
- execute_command("lua_unload YOUR_SCRIPT_NAME") -- << Enter your script name to UNLOAD when game is over
- end
- -- Created by H® Shaft
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement