SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/01/2010, 07:25 AM   #11
SPFoxy
Big Clucker
 
Join Date: Sep 2008
Posts: 180
Reputation: 1
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

Looks sexy
SPFoxy is offline   Reply With Quote
Old 29/01/2010, 08:18 AM   #12
cyber_punk
Huge Clucker
 
Join Date: Feb 2008
Location: Det. Mi. USA.....
Posts: 435
Reputation: 10
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

Hmm, I'll give it a shot, Thanks. Maybe I can finally get rid of the odd flashing purple screen bug, that tends to happen with _Seif's.
__________________
cyber_punk is offline   Reply With Quote
Old 29/01/2010, 09:21 AM   #13
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,596
Reputation: 379
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

Quote:
Originally Posted by cyber_punk
Hmm, I'll give it a shot, Thanks. Maybe I can finally get rid of the odd flashing purple screen bug, that tends to happen with _Seif's.
I did a quite a bit of work to keep colors from freaking out.
Colors can't reach outside of the usual spectrum (o-255)
When the math of 'step' doesn't match out it fixes it, for example:
You want the AA to go from 255 to 0 in 100 steps (roughly 10 seconds)
You would take the initial color and subtract the ending color, so 255-0 = 255
then divide by the steps (255/100)
but in programming this doesn't give 2.55, it gives 2 (always rounds down unless specified otherwise)
This means we'll change the color 100 times and subtract 2 from 255 each time, but this comes up with a remainder (255 -(100*2) = 55)
so what I do is add to the steps how much is left using the same subtractee (2)
Remainder (55) divide by our subtractee (2) is how many steps we're gonna need to add (55/2=27,rounded down)
So now there are 127 steps, not 100
Joe Staff is offline   Reply With Quote
Old 29/01/2010, 11:30 AM   #14
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 2,929
Reputation: 700
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

Nice release, but Seif's I'll keep using Seif's though.
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 29/01/2010, 12:17 PM   #15
RenisiL
Huge Clucker
 
RenisiL's Avatar
 
Join Date: Aug 2008
Posts: 472
Reputation: 4
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

It's very nice
RenisiL is offline   Reply With Quote
Old 08/02/2010, 11:16 PM   #16
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,596
Reputation: 379
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

Updated it with version 2.

Only a small change:
SetPlayerPosFade(playerid,steps,interiorid,Float ,Float:y,Float:z); //Version 2 only
This is basically a MIC function. It will fade the player's screen to black, teleport and set interior, then fade from black to clear again for a smooth teleporting transition.

Originally made for ML-RP, but unfortunately was incompatible.
Joe Staff is offline   Reply With Quote
Old 08/02/2010, 11:52 PM   #17
Fedee!
Huge Clucker
 
Fedee!'s Avatar
 
Join Date: Jan 2010
Posts: 453
Reputation: 0
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

Nice INC man!!

Great work

Gotta question, how can I make this:
pawn Code:
#include <a_samp>
#include <j_fader>
new Float:gTmp;
new Float:pOldHealth[MAX_PLAYERS];
public OnFilterScriptInit()
{
  FadeInit();
  return 1;
}
public OnFilterScriptExit()
{
  FadeExit();
  return 1;
}
public OnPlayerConnect(playerid)
{
  FadePlayerConnect(playerid);
  return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
  FadePlayerDisconnect(playerid);
  return 1;
}
public OnPlayerUpdate(playerid)
{
  GetPlayerHealth(playerid,gTmp);
  if(pOldHealth[playerid]>gTmp)
  {
    FadeColorForPlayer(playerid,255,0,0,floatround(pOldHealth[playerid]-gTmp)*10,255,0,0,0,floatround(pOldHealth[playerid]-gTmp),0);
  }
  pOldHealth[playerid]=gTmp;
  return 1;
}
to work by crashing the car and when you get killed?

EDIT: Also, how can I make this
pawn Code:
FadeColorForPlayer(playerid,0,0,0,255,0,0,0,0,15,0);
to be first white(clear) and then to fade to black?

Thanks!
Fedee! is offline   Reply With Quote
Old 09/02/2010, 10:19 AM   #18
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,596
Reputation: 379
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

@Fedee:
pawn Code:
#include <a_samp>
#include <j_fader_v2>
new Float:gTmp;
new Float:pOldHealth[MAX_PLAYERS];
new Float:vSpeed[MAX_PLAYERS];
new Float:gtemp[4]; //global temporary variables
new JustDied[MAX_PLAYERS];
public OnFilterScriptInit()
{
  FadeInit();
  return 1;
}
public OnFilterScriptExit()
{
  FadeExit();
  return 1;
}
public OnPlayerConnect(playerid)
{
  FadePlayerConnect(playerid);
  JustDied[playerid]=0;
  return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
  FadePlayerDisconnect(playerid);
  return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
  FadeColorForPlayer(playerid,255,0,0,0,255,0,0,255,25,1000);
  JustDied[playerid]=1;
  return 1;
}
public OnPlayerSpawn(playerid)
{
    if(JustDied[playerid])
    {
    FadeColorForPlayer(playerid,255,0,0,255,255,0,0,0,25,0);
    JustDied[playerid]=0;
    }
  return 1;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate==PLAYER_STATE_ONFOOT)vSpeed[playerid]=0;
    return 1;
}
public OnPlayerUpdate(playerid)
{
  GetPlayerHealth(playerid,gTmp);
  if(pOldHealth[playerid]>gTmp)
  {
    FadeColorForPlayer(playerid,255,0,0,floatround(pOldHealth[playerid]-gTmp)*10,255,0,0,0,floatround(pOldHealth[playerid]-gTmp),0);
  }
  pOldHealth[playerid]=gTmp;
  if(IsPlayerInAnyVehicle(playerid))
  {
    GetVehicleVelocity(GetPlayerVehicleID(playerid),gtemp[0],gtemp[1],gtemp[2]);
    gtemp[3]=floatsqroot( floatmul(gtemp[0],gtemp[0])+floatmul(gtemp[1],gtemp[1])+floatmul(gtemp[2],gtemp[2]) )*100;
    if(vSpeed[playerid]-gtemp[3]>20)FadeColorForPlayer(playerid,255,0,0,(floatround(vSpeed[playerid]-gtemp[3])-20)*3,255,0,0,0,floatround(vSpeed[playerid]-gtemp[3])-20,0);
    vSpeed[playerid]=gtemp[3];
  }
  return 1;
}


I haven't tested that, but I will later on. If it works I'll add it to the front page.

Tested and it works great
I even guessed the vehicle speeds correctly, lol.
Joe Staff is offline   Reply With Quote
Old 09/02/2010, 12:39 PM   #19
Fedee!
Huge Clucker
 
Fedee!'s Avatar
 
Join Date: Jan 2010
Posts: 453
Reputation: 0
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

Quote:
Originally Posted by Joe Staff
@Fedee:
pawn Code:
#include <a_samp>
#include <j_fader_v2>
new Float:gTmp;
new Float:pOldHealth[MAX_PLAYERS];
new Float:vSpeed[MAX_PLAYERS];
new Float:gtemp[4]; //global temporary variables
new JustDied[MAX_PLAYERS];
public OnFilterScriptInit()
{
  FadeInit();
  return 1;
}
public OnFilterScriptExit()
{
  FadeExit();
  return 1;
}
public OnPlayerConnect(playerid)
{
  FadePlayerConnect(playerid);
  JustDied[playerid]=0;
  return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
  FadePlayerDisconnect(playerid);
  return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
  FadeColorForPlayer(playerid,255,0,0,0,255,0,0,255,25,1000);
  JustDied[playerid]=1;
  return 1;
}
public OnPlayerSpawn(playerid)
{
    if(JustDied[playerid])
    {
    FadeColorForPlayer(playerid,255,0,0,255,255,0,0,0,25,0);
    JustDied[playerid]=0;
    }
  return 1;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate==PLAYER_STATE_ONFOOT)vSpeed[playerid]=0;
    return 1;
}
public OnPlayerUpdate(playerid)
{
  GetPlayerHealth(playerid,gTmp);
  if(pOldHealth[playerid]>gTmp)
  {
    FadeColorForPlayer(playerid,255,0,0,floatround(pOldHealth[playerid]-gTmp)*10,255,0,0,0,floatround(pOldHealth[playerid]-gTmp),0);
  }
  pOldHealth[playerid]=gTmp;
  if(IsPlayerInAnyVehicle(playerid))
  {
    GetVehicleVelocity(GetPlayerVehicleID(playerid),gtemp[0],gtemp[1],gtemp[2]);
    gtemp[3]=floatsqroot( floatmul(gtemp[0],gtemp[0])+floatmul(gtemp[1],gtemp[1])+floatmul(gtemp[2],gtemp[2]) )*100;
    if(vSpeed[playerid]-gtemp[3]>20)FadeColorForPlayer(playerid,255,0,0,(floatround(vSpeed[playerid]-gtemp[3])-20)*3,255,0,0,0,floatround(vSpeed[playerid]-gtemp[3])-20,0);
    vSpeed[playerid]=gtemp[3];
  }
  return 1;
}


I haven't tested that, but I will later on. If it works I'll add it to the front page.

Tested and it works great
I even guessed the vehicle speeds correctly, lol.
Thanks dude !!

EDIT: Another thing, how can I make if someone puts /home the screens fades to black, and then it clears again fading out?
Thanks !

EDIT2: Nevermind.. SetPlayerPosFade(playerid,steps,interiorid,Float ,Float:y,Float:z) is the same.
Fedee! is offline   Reply With Quote
Old 09/02/2010, 09:56 PM   #20
Chaprnks
Gangsta
 
Chaprnks's Avatar
 
Join Date: Sep 2007
Location: Soviet America
Posts: 578
Reputation: 69
Default Re: [INC]Screen Fader -- Supports color-to-color fades!

You should use ALS so you don't have to add those functions (ex: FadeInit under OnFilterScript/GameModeInit).
__________________
Chaprnks 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
[Include] [INC] Color Inlcude (Most used color defines in one include!) (New Link) Oxside Includes 19 14/05/2014 06:42 PM
[FilterScript] [FS] Color screen v1+2 (could be used for a drug effect on RP servers) Correlli Filterscripts 32 16/10/2010 11:39 PM
color/car-color/weapon Defines BurningSWA Help Archive 1 13/02/2010 01:39 PM


All times are GMT. The time now is 03:21 AM.


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