[Include] FadeScreen by Maku
#1

FadeScreen by Maku (MP_Spec in forum.sa-mp.com)
Version: 2.1


This is similar to http://forum.sa-mp.com/showthread.ph...t=screen+fader

*******:
[ame]http://www.youtube.com/watch?v=puAziqq09jc[/ame]

Callbacks:

Код:
public OnPlayerFadeScreenEnd(playerid, fadeid, timeleft, step)
Callback called when the end of the color transfer on the screen.

Parameters:
playerid - Player ID.
fadeid - Fadescreen ID.
timeleft - The time that has passed since the launch until the end of the display.
step - The number of changes that survived textdraw to view the final color.
Код:
public OnPlayerFadeScreenChange(playerid, fadeid, timeleft, step)
Callback called when changes color on the screen.

Parameters:
playerid - Player ID.
fadeid - Fadescreen ID.
timeleft - The time that has passed since the launch of fadescreen to call this callback'a.
step - The number of changes that survived textdraw.
Functions

Код:
native ShowPlayerFadeScreenToBlank(playerid, speed, red, green, blue, alpha);
This function displays the entire screen given color and gradually disappears by a fixed speed.
Speed ​​is entered in reverse! The smaller the faster!

Parameters:
playerid - ID player, who has to show fadescreen
speed - speed color disappear.
red - "Quantity" red color (0 to 255).
green - "Quantity" green (0 to 255).
blue - "Quantity" blue color (0 to 255).
alpha - the start color transparency (0 transparency, 255 opaque) (0 to 255).

Returns the fadescreen ID.
Код:
native ShowPlayerFadeScreen(playerid, speed, s_red, s_green, s_blue, s_alpha, e_red, e_green, e_blue, e_alpha);
This in turn displays a full-screen given color and gradually changes into another.
Speed ​​is entered in reverse! The smaller the faster!

Parameters:
playerid - ID player, who has to show fadescreen
speed - the speed of the color change.
s_red - "Number" at the beginning of the red color (0 to 255).
s_green - "Number" at the beginning of the green color (0 to 255).
s_blue - "Number" at the beginning of the blue color (0 to 255).
s_alpha - at the beginning of the color transparency (0 transparency, 255 opaque) (0 to 255).
e_red - "Number" at the end of the red color (0 to 255).
e_green-"Number" at the end of the green color (0 to 255).
e_blue - "Number" at the end of the blue color (0 to 255).
e_alpha - at the end of the color transparency (0 transparency, 255 opaque) (0 to 255).

Return the Fadescreen ID.
Код:
native ShowPlayerFadeScreenRandom(playerid, speed, alpha);
Displays random fadescreen a random start and end color.

Parameters:
playerid - Player ID, which display the fadescreen
speed ​​- The speed of the color change.
alpha - Transparency fadescreen (0 transparent, opaque 255) (0 to 255).

Return the Fadescreen ID.
Код:
native HidePlayerFadeScreen(playerid)
Stops and hides fadescreen that is currently displayed to him (you can also view other fadescreen)

Parameters:
playerid - Player ID
Код:
native RGB(red, green, blue, alpha);
Converts the RGB color.

Parameters:
red - Number of red .
green - Number of green.
blue - Number of blue.
alpha - Transparency.

Return color.
Код:
native ShowPlayerFilledScreen(playerid, red, green, blue, alpha);
Displays full screen player color (does not penetrate, it just is displayed).

Parameters:
playerid - Player ID
red - Number of red .
green - Number of green.
blue - Number of blue.
Alpha - Transparency.
Код:
native HidePlayerFilledScreen(playerid)
It works the same way as HidePlayerFadeScreen ()
Examples:
Код:
#include a_samp.inc
#include fadescreen.inc

public OnPlayerSpawn(playerid)
{
    ShowPlayerFadeScreen(playerid, 20, 255, 0, 0, 255, 255, 255,0, 0);
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        GameTextForPlayer(playerid, "~r~Odpalanie silnika...", 9999, 3);
         new id = ShowPlayerFadeScreenToBlank(playerid, 10, 0, 0, 255, 255);
         SetPVarInt(playerid, "OdpalSilnik", id);

         new engine,lights,doors,bonnet,alarm,boot,objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(GetPlayerVehicleID(playerid),0,lights,alarm,doors,bonnet,boot,objective);
    }
    return 1;
}
public OnPlayerFadeScreenEnd(playerid, fadeid)
{
    if(fadeid == GetPVarInt(playerid, "OdpalSilnik"))
    {
           new engine,lights,doors,bonnet,alarm,boot,objective;
        GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(GetPlayerVehicleID(playerid),1,lights,alarm,doors,bonnet,boot,objective);
        GameTextForPlayer(playerid, "~r~Silnik zostal odpalony!", 1000, 3);
    }
    return 1;
}
Код:
public OnPlayerFadeScreenChange(playerid, fadeid, timeleft, step)
{
    new str[128];
    format(str, 128, "Fadeid: %d Timeleft: %d ms Steps: %d",  fadeid, timeleft, step);
    SendClientMessage(playerid, -1, str);
    return 1;
}
public OnPlayerFadeScreenEnd(playerid, fadeid, timeleft, step)
{
    new str[128];
    format(str, 128, "Fadeid: %d Timeleft: %d ms Steps: %d",  fadeid, timeleft, step);
    SendClientMessage(playerid, -1, str);
    return 1;
}
Код:
public OnPlayerFadeScreenEnd(playerid, fadeid, timeleft, step)
{
    if(fadeid == PlayerInfo[playerid][pFade])
    {
           ShowPlayerFilledScreen(playerid, 0, 255, 0, 150);
    }
    return 1;
}
Код:
SendClientMessage(playerid, RGB(255,0,255,255), "Example message.");
Download:
Mirror 1: http://www.solidfiles.com/d/83f0095e9b/
Mirror 2: http://makuhost.098.pl/fadescreen.html (private hosting, polish language).

-----

Polish description: http://pawno.pl/index.php?/topic/154...creen-by-maku/

I'm sorry for my poor english, I'm from Poland.
If you find a mistake in my message, let me know.
Reply
#2

This will probably cause quite a bit of lag and will be prone to be being buggy if used on a lot of players at once. I had a similar function and had to remove it because of that also consider not using CallRemoteFunction() it is slow. This will work well with a few players but try fading 15+ players I'm pretty sure there might be some problems.
Reply
#3

Well, I guess it might lag a bit if many people is using that at once since the timers are no repeated. However use CallLocalFunction instead of CallRemoteFunction.
Reply
#4

Код:
However use CallLocalFunction instead of CallRemoteFunction.
CallRemoteFunction - callback calls in all scripts.

Код:
is using that at once since the timers are no repeated.
Processor vs Memory.

I'll try to do it in a plugin to improve the optimization, but can not promise anything.
Reply
#5

Quote:
Originally Posted by MP_Spec
Посмотреть сообщение
Код:
However use CallLocalFunction instead of CallRemoteFunction.
CallRemoteFunction - callback calls in all scripts.

Код:
is using that at once since the timers are no repeated.
Processor vs Memory.

I'll try to do it in a plugin to improve the optimization, but can not promise anything.
Includes are an actual part of the gamemode. It's the same script if you think about it during compile time.
Reply
#6

Quote:
Originally Posted by MP_Spec
Посмотреть сообщение
Код:
However use CallLocalFunction instead of CallRemoteFunction.
CallRemoteFunction - callback calls in all scripts.
Why should I combine the script from the callback from the gamemode with the filterscript? I can't do anything else beside that, and I think that it is not a good usage of that function for this case.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)