SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 25/12/2018, 07:24 AM   #1
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,243
Reputation: 379
Default Rewind (Time machine)


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):

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:

Code:
public OnPlayerRewindForPlayer(playerid, forplayerid)
public OnPlayerStartRewind(playerid)
public OnPlayerFinishRewind(playerid)

public OnPlayerFastRewind(playerid)
public OnPlayerFinishFastRewind(playerid)
Functions:

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.


Originally inspired from Life is strange video game, here's the rewind SFX used:
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.

Topic is not open for discussions i'm not replying on anything anymore, if you're interested in this do your own fork and your own version of it i'm done, if anything do a pull request and if i'm interested enough i might merge it.
__________________
Be creative.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link



Last edited by RogueDrifter; 10/01/2019 at 02:18 AM.
RogueDrifter is offline   Reply With Quote
Old 25/12/2018, 07:28 AM   #2
iLearner
Gangsta
 
iLearner's Avatar
 
Join Date: Apr 2017
Posts: 634
Reputation: 134
Default Re: Rewind (Time machine)

Liked and subscribed.
iLearner is offline   Reply With Quote
Old 25/12/2018, 07:46 AM   #3
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 599
Reputation: 53
Default Re: Rewind (Time machine)

Nice.
You can also do this
PHP Code:
#if !defined FILTERSCRIPT
public OnGameModeInit()
#else
public OnFilterScriptInit()
#endif
{
    
//code

I checked the code a little bit. I think every thing under OnGameModeInit and OnFilterScriptInit is same....
__________________
coool is offline   Reply With Quote
Old 25/12/2018, 07:48 AM   #4
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,243
Reputation: 379
Default Re: Rewind (Time machine)

Quote:
Originally Posted by coool View Post
Nice.
You can also do this
PHP Code:
#if !defined FILTERSCRIPT
public OnGameModeInit()
#else
public OnFilterScriptInit()
#endif
{
    
//code

I checked the code a little bit. I think every thing under OnGameModeInit and OnFilterScriptInit is same....
There's already a check for
pawn Code:
#if !defined FILTERSCRIPT
Click here
__________________
Be creative.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 25/12/2018, 10:33 AM   #5
GhostHacker9
Big Clucker
 
GhostHacker9's Avatar
 
Join Date: Jan 2017
Location: New Zealand
Posts: 107
Reputation: 109
Default Re: Rewind (Time machine)

Quote:
Originally Posted by RogueDrifter View Post
There's already a check for
pawn Code:
#if !defined FILTERSCRIPT
Click here
I think he meant you can avoid repeated code blocks by using the macro that way..which is more cleaner and good programming habit..

Btw nice idea
GhostHacker9 is offline   Reply With Quote
Old 25/12/2018, 10:42 AM   #6
Hunud
Gangsta
 
Hunud's Avatar
 
Join Date: Jun 2016
Posts: 819
Reputation: 47
Default Re: Rewind (Time machine)

Thank you Santa.
Hunud is offline   Reply With Quote
Old 25/12/2018, 04:16 PM   #7
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,243
Reputation: 379
Default Re: Rewind (Time machine)

Quote:
Originally Posted by GhostHacker9 View Post
I think he meant you can avoid repeated code blocks by using the macro that way..which is more cleaner and good programming habit..

Btw nice idea
Oh now i get it! Mb misread that before, well only one part will get compiled but i do get where you're coming from I'll implement it later on. Thanks!


@Hunud, yw son c:
__________________
Be creative.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 25/12/2018, 06:00 PM   #8
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,345
Reputation: 1271
Default Re: Rewind (Time machine)

Looks interesting, and very creative.
Pottus is offline   Reply With Quote
Old 26/12/2018, 01:51 PM   #10
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,243
Reputation: 379
Default Re: Rewind (Time machine)

Thanks @Sys & @Pottus
__________________
Be creative.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If you would have a Time Machine Erwin. Everything and Nothing 39 08/02/2019 11:20 AM
Is this machine able to run sa:mp and ... actiwe Server Support 9 11/08/2010 08:50 PM
running samp server from vitrual machine affects host machine? Smokey619 Server Support 1 05/05/2010 09:53 PM
[WEB] The SA:MP Time Machine! Discover every SA:MP version. JonyAvati Everything and Nothing 14 27/11/2009 05:16 PM


All times are GMT. The time now is 05:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.