forked from taskinoz/Enhanced-Menu-Mod
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
38 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
untyped | ||
global function SaveStateInit | ||
|
||
struct { | ||
bool savestateExists = false | ||
vector position | ||
vector angles | ||
vector velocity | ||
} file | ||
|
||
void function SaveStateInit( entity player ) | ||
{ | ||
AddClientCommandCallback( "createsavestate", Pressed_CreateSaveState ) | ||
AddClientCommandCallback( "loadsavestate", Pressed_LoadSaveState ) | ||
} | ||
|
||
bool function Pressed_CreateSaveState( entity player, array<string> args ) | ||
{ | ||
file.position = player.GetOrigin() | ||
file.angles = player.GetAngles() | ||
file.velocity = player.GetVelocity() | ||
file.savestateExists = true | ||
return true | ||
} | ||
|
||
bool function Pressed_LoadSaveState( entity player, array<string> args ) | ||
{ | ||
if (!file.savestateExists || !SRMM_getSetting(SRMM_settings.practiceMode)) return false | ||
player.SetOrigin(file.position) | ||
player.SetAngles(file.angles) | ||
player.SetVelocity(file.velocity) | ||
return true | ||
} |