10.03.2019, 12:11
(
Last edited by RIDE2DAY; 10/03/2019 at 03:00 PM.
)
DissolvePlayerScreen v0.01
[*] Introduction
Hello, this is an include I've scripted for my gamemode but I decided to share it here, luckily someone else finds it useful. I'm using YSI 4.x right now for my gamemode, so this include makes use of it also.
I know there are other includes like this out there, but I decided to script this because YSI allows me to do it without the need of additional includes. If you don't use YSI and you don't want to, maybe easy-fade by kvann is what you're looking for. kvann's include inspired me to script this version.
Please note the main purpose of this script is to dissolve the screen for cinematics and create a transition between scenes. It could also be used when entering interiors to loads objects and similar stuff. This hasn't been made to flash player's screen when he takes damage or when he crashes a car.
[*] Video
Here you can find a video.
You can find the code which I used in the video on the GitHub repository.
[*] Download
Here is the GitHub repository.
[*] Documentation
This include is really simple, these are the functions available:
Code:
IsPlayerScreenDissolving(playerid) DissolvePlayerScreenToBlank(playerid, Func:response_func<i> = NO_TRANSITION_RESPONSE) DissolvePlayerScreenToBlack(playerid, Func:response_func<i> = NO_TRANSITION_RESPONSE) DissolvePlayerScreen(playerid, init_color, end_color, Func:response_func<i> = NO_TRANSITION_RESPONSE)
I've added DissolvePlayerScreenToBlank and DissolvePlayerScreenToBlack to make things easier for me, only black is used there for the interpolation, basically it interpolates the alpha value from 0x00 to 0xFF and vice versa. Consider them shortcuts.
If you use YSI remember you can use y_colours to access colors easier. For example:
PHP Code:
public OnPlayerConnect(playerid)
{
// Dissolve from transparent black to full orange:
DissolvePlayerScreen(playerid, Y_BLACK | 0x00, Y_ORANGE | 0xFF, &Transition_Complete);
return 1;
}
Transition_Complete(playerid)
{
// Dissolve from full orange to transparent black.
DissolvePlayerScreen(playerid, Y_ORANGE | 0xFF, Y_BLACK | 0x00);
}
/*
In this case the colors used for the interpolation were BLACK
and ORANGE, but you could use whatever you wish, obviously.
*/
[*] Other
Thank you for reading my thread, if you want to support what I do you might buy me a coffe! Join to my Discord server if you want to follow the development of my gamemode.
If you find any bug, please let me know.
Best regards.