- Joined
- Jun 23, 2007
- Messages
- 4,066
PreventSave - Disable Game Saving
JASS:
library PreventSave initializer onInit
/***************************************************************
*
* v1.0.1 by TriggerHappy
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* This library allows you to enable or disable game saving. It works by showing
* a dialog instantly before a game is saved, causing the save to interrupt. There
* are no known side effects.
* _________________________________________________________________________
* 1. Installation
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* Copy the script to your map and save it (requires JassHelper *or* JNGP)
* _________________________________________________________________________
* 2. API
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* function SaveGameEnable takes boolean flag returns nothing
* function IsSaveEnabled takes nothing returns boolean
* function PreventSave takes player p, boolean flag returns nothing
*
***************************************************************/
globals
boolean GameAllowSave = false
endglobals
//====================================
// Do not edit below this line
//====================================
globals
private dialog Dialog = DialogCreate()
private timer Timer = CreateTimer()
private player LocalPlayer
endglobals
function SaveGameEnable takes boolean flag returns nothing
set GameAllowSave = flag
endfunction
function IsSaveEnabled takes nothing returns boolean
return GameAllowSave
endfunction
function PreventSave takes player p, boolean flag returns nothing
if (p == LocalPlayer) then
call SaveGameEnable(not flag)
endif
endfunction
private function Exit takes nothing returns nothing
call DialogDisplay(LocalPlayer, Dialog, false)
endfunction
private function StopSave takes nothing returns boolean
if not IsSaveEnabled() then
call DialogDisplay(LocalPlayer, Dialog, true)
endif
call TimerStart(Timer, 0.00, false, function Exit)
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
set LocalPlayer = GetLocalPlayer()
call TriggerRegisterGameEvent(t, EVENT_GAME_SAVE)
call TriggerAddCondition(t, Filter(function StopSave))
endfunction
endlibrary
Last edited: