2019-11-09, 11:15 PM
(This post was last modified: 2019-11-10, 12:51 AM by RogueDrifter.)
Time machine
- Updated Jan,8th 2019
Rewind
A rewind/time machine script that takes you back a few steps/actions! Includes textdraws and 3D text labels.
Github: https://github.com/RogueDrifter/Rewind
Screenshots
1-
2-
3-
Video
Epilepsy warning.
Make sure you got your sound on:
Another video without camera movements or flashes: CLICK ME
A third video without effects and with a faster rewind rate: CLICK ME settings used were 250 buffer and 10ms timer
Installation
Simply install to your project:
Code:
sampctl package install RogueDrifter/Rewind
Include in your code and begin using the library (Only in one script):
PHP Code:
#include <Rewind>
Usage
There's a part newly added, now you can control the rewind times a player can go back:
Code:
#define REWIND_MAXIMUM_PHASES [NUMBER] //Between 5 and 29 (Or equal to either)
#define REWIND_CHOOSING_DIALOG [NUMBER] //Dialog ID for the fast rewind you can change for whatever reason
#define REWiND_FULLY_SYNCED_TIMER [NUMBER] //This is in MS you can change it depending on how fast you want the timers to record/play, default is 100ms
#define SYNCEED_REWIND_BUFFER [NUMBER] //This is the capacity of the fast rewind cells, don't change this if you don't know what you're doing, default is 85
Callbacks:
PHP Code:
public OnPlayerRewindForPlayer(playerid, forplayerid)
public OnPlayerStartRewind(playerid)
public OnPlayerFinishRewind(playerid)
public OnPlayerFastRewind(playerid)
public OnPlayerFinishFastRewind(playerid)
Functions:
PHP Code:
ShowTimeMachineSynced(playerid)
HideTimeMachineSynced(playerid)
StartRewinding(playerid) //This is automated keeps recording forever which shows on the 3D text label and the textdraw bar, can be disabled by an option above. Can be controllable for how many records to keep by the definition above.
StartRecordingRewindSynced(playerid) //This is the 'fast' synced rewind that asks by request with a dialog and lasts recording if you keep moving for 10-13 seconds
bool:IsPlayerInvolvedInRewind(playerid)
bool:IsPlayerRewinding(playerid)
bool:IsPlayerFastRewinding(playerid)
ToggleRewindFlash(bool:toggle)
ToggleRewindFlashForPlayer(playerid, bool:toggle)
ToggleRewindCameraMove(bool:toggle)
ToggleRewindCameraMoveForPlayer(playerid, bool:toggle)
ToggleRewindAuto(bool:toggle)
ToggleRewindAutoForPlayer(playerid, bool:toggle)
ToggleWorldRewind(bool:toggle) // This one and the one after it control the ability for when one rewinds with the automated feature does everyone around him also gets a forced rewind as well or not
ToggleWorldRewindForPlayer(playerid, bool:toggle)
Keep in mind all of the above are 'true' for disable and 'false' for enable that's how they're all enabled by default.
History
Updates:
Code:
1- Included interior, virtual world and angles of both cars and players in the rewind
2- Simplified code (Well actually more complicated but more self-independent) Which led to:
3- You can now choose how many steps you can go back! through the REWIND_MAXIMUM_PHASES part above in the usage
4- More screenshots added #3 above
5- Now the audio stream will loop itself every time the rewind happens to make sure the sound keeps going!
6- 3D Text label will go green when the player breaches the 3 bars limit
7- Fixed code errors and added fast rewind with more functions/callbacks and a video display
8- Added another video, 2 more features to control the fast rewind and further explanations in comments
Testing
To test, simply run the package:
Code:
sampctl package run
Extras
1- A timer that rolls over to sync all player's ability to rewind.
2- Textdraws that define the rewind ability.
3- 3D Text labels to mark for other players your ability to rewind.
Do know that if someone rewinds, every streamed-in player will be forced to go back and rewind as well, that's how it works, which is also controllable by the functions above.