AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Screen Fade (https://forums.alliedmods.net/showthread.php?t=155174)

andrzN 04-18-2011 10:43

Screen Fade
 
Hello!
I need a plugin that fades CT's screen from black(255) to clear(0) slowly in a time of 10 seconds.
It should, as said above, only work for CT, and it should fade the screen every new round!

Thaaaaanks: D

ConnorMcLeod 04-18-2011 12:02

Re: Screen Fade
 
Are you using (willing to use) orpheu ?

andrzN 04-18-2011 13:04

Re: Screen Fade
 
Quote:

Originally Posted by ConnorMcLeod (Post 1452936)
Are you using (willing to use) orpheu ?

what is orpheu?: s

ConnorMcLeod 04-18-2011 14:12

Re: Screen Fade
 
A module not integrated to default amxx, nvm.

Arkshine 04-18-2011 14:34

Re: Screen Fade
 
Is really necessary to use Orpheu here ?

andrzN 04-18-2011 14:51

Re: Screen Fade
 
I'm sorry if I sound like a retard. But I've got no idea what the orpheu does. If either fo you could script me this small plugin, I would be more that thankfull. Or ofcourse, which is why I posted in scripting help, you can give me the parts of the code that I need to make the plugin work:P

ConnorMcLeod 04-18-2011 16:44

Re: Screen Fade
 
Quote:

Originally Posted by Arkshine (Post 1453100)
Is really necessary to use Orpheu here ?

Not really.


So, is CT freezetime during regular freezetime or just after regular freezetime ?

andrzN 04-18-2011 17:18

Re: Screen Fade
 
during regular freezetime. It's normal freezetime for CT Only

ConnorMcLeod 04-19-2011 12:28

Re: Screen Fade
 
You have to compile locally with this include : http://forums.alliedmods.net/showthread.php?t=87623

PHP Code:

/*    Formatright © 2010, ConnorMcLeod

    This plugin is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <screenfade_util.inc>

#define VERSION "0.0.2"
#define PLUGIN "FrrezeTime ScreenFade"

new g_bFreezePeriod true

new g_pCvarFadeTeamg_pCvarColorAlpha[2]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_pCvarFadeTeam register_cvar("amx_freezefade_team""2"// 0:nobody 1:Ts 2:CTs 3:all
    
g_pCvarColorAlpha[0] = register_cvar("amx_fade_t""250000000255"// RRRGGGBBB / R=Red G=Green B=Blue A=Alpha
    
g_pCvarColorAlpha[1] = register_cvar("amx_fade_ct""000000250255"// RRRGGGBBB / R=Red G=Green B=Blue A=Alpha

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_logevent("LogEvent_Round_Start"2"1=Round_Start")
    
RegisterHam(Ham_Spawn"player""CBasePlayer_Spawn_Post"true)
}

public 
Event_HLTV_New_Round()
{
    
g_bFreezePeriod true
}

public 
CBasePlayer_Spawn_Post(id)
{
    if( 
g_bFreezePeriod && is_user_alive(id) )
    {
        new 
iTeam _:cs_get_user_team(id)
        if( 
get_pcvar_num(g_pCvarFadeTeam) & iTeam )
        {
            new 
iColor[3], iAlpha
            get_pcvar_color_alpha
(g_pCvarColorAlpha[iTeam-1], iColoriAlpha)
            
UTIL_ScreenFade(id,iColor,1.0,_,iAlpha,FFADE_OUT|FFADE_STAYOUT,true)
        }
    }
}

get_pcvar_color_alphag_pCvar iColor[] , &iAlpha=)
{
    new 
szColor[13]
    if( 
get_pcvar_string(g_pCvarszColorcharsmax(szColor)) != charsmax(szColor) )
    {
        
abort(AMX_ERR_GENERAL"Color cvar must be 12 chars, format ^"RRRGGGBBBAAA^"")
    }
    
iColor[Red] = parse_colorszColor)
    
iColor[Green] = parse_colorszColor)
    
iColor[Blue] = parse_colorszColor)
    
iAlpha parse_colorszColor)
}

parse_color(szColor[], iStart)
{
    return 
100 szColor[iStart] + 10 szColor[iStart+1] + szColor[iStart+2] - 5328
}

public 
LogEvent_Round_Start()
{
    
g_bFreezePeriod false

    
new iPlayers[32], iNumiColor[3], iAlpha
    
new iTeamCvar get_pcvar_num(g_pCvarFadeTeam)
    if( 
iTeamCvar _:CS_TEAM_T )
    {
        
get_players(iPlayersiNum"ae""TERRORIST")
        
get_pcvar_color_alpha(g_pCvarColorAlpha[0], iColoriAlpha)
        for(--
iNumiNum>=0iNum--)
        {
            
UTIL_ScreenFade(iPlayers[iNum], iColor2.0_iAlpha)
        }
    }
    if( 
iTeamCvar _:CS_TEAM_CT )
    {
        
get_players(iPlayersiNum"ae""CT")
        
get_pcvar_color_alpha(g_pCvarColorAlpha[1], iColoriAlpha)
        for(--
iNumiNum>=0iNum--)
        {
            
UTIL_ScreenFade(iPlayers[iNum], iColor2.0_iAlpha)
        }
    }



andrzN 04-19-2011 20:53

Re: Screen Fade
 
Quote:

Originally Posted by ConnorMcLeod (Post 1453622)
You have to compile locally with this include : http://forums.alliedmods.net/showthread.php?t=87623

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <screenfade_util.inc>

#define VERSION "0.0.1"
#define PLUGIN "FrrezeTime ScreenFade"

new g_bFreezePeriod true

new g_pCvarFadeTeamg_pCvarColorAlpha[2]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_pCvarFadeTeam register_cvar("amx_freezefade_team""2"// 0:nobody 1:Ts 2:CTs 3:all
    
g_pCvarColorAlpha[0] = register_cvar("amx_fade_t""250 0 0 255"// RRRGGGBBB / R=Red G=Green B=Blue A=Alpha
    
g_pCvarColorAlpha[1] = register_cvar("amx_fade_ct""0 250 0 255"// RRRGGGBBB / R=Red G=Green B=Blue A=Alpha

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_logevent("LogEvent_Round_Start"2"1=Round_Start")
    
RegisterHam(Ham_Spawn"player""CBasePlayer_Spawn_Post"true)
}

public 
Event_HLTV_New_Round()
{
    
g_bFreezePeriod true
}

public 
CBasePlayer_Spawn_Post(id)
{
    if( 
g_bFreezePeriod && is_user_alive(id) )
    {
        new 
iTeam _:cs_get_user_team(id)
        if( 
get_pcvar_num(g_pCvarFadeTeam) & iTeam )
        {
            new 
iColor[3], iAlpha
            get_pcvar_color_alpha
(g_pCvarColorAlpha[iTeam-1], iColoriAlpha)
            
UTIL_ScreenFade(id,iColor,1.0,_,iAlpha,FFADE_OUT|FFADE_STAYOUT,true)
        }
    }
}

get_pcvar_color_alphag_pCvar iColor[3] , &iAlpha=)
{
    new 
szColor[16], szRed[4], szGreen[4], szBlue[4], szAlpha[4]
    
get_pcvar_string(g_pCvarszColorcharsmax(szColor))
    
parse(szColorszRedcharsmax(szRed), szGreencharsmax(szGreen), szBluecharsmax(szBlue), szAlphacharsmax(szAlpha))
    
iColor[0] = str_to_num(szRed)
    
iColor[1] = str_to_num(szGreen)
    
iColor[2] = str_to_num(szBlue)
    
iAlpha str_to_num(szAlpha)
}

public 
LogEvent_Round_Start()
{
    
g_bFreezePeriod false

    
new iPlayers[32], iNumiColor[3], iAlpha
    
new iTeamCvar get_pcvar_num(g_pCvarFadeTeam)
    if( 
iTeamCvar _:CS_TEAM_T )
    {
        
get_players(iPlayersiNum"ae""TERRORIST")
        
get_pcvar_color_alpha(g_pCvarColorAlpha[0], iColoriAlpha)
        for(--
iNumiNum>=0iNum--)
        {
            
UTIL_ScreenFade(iPlayers[iNum], iColor2.0_iAlpha)
        }
    }
    if( 
iTeamCvar _:CS_TEAM_CT )
    {
        
get_players(iPlayersiNum"ae""CT")
        
get_pcvar_color_alpha(g_pCvarColorAlpha[1], iColoriAlpha)
        for(--
iNumiNum>=0iNum--)
        {
            
UTIL_ScreenFade(iPlayers[iNum], iColor2.0_iAlpha)
        }
    }




Thank you ever so much, youre awesome! Thanks to you others too!
I like the support here on AM!


All times are GMT -4. The time now is 19:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.