Raised This Month: $32 Target: $400
 8% 

Screen fade turn on / off


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 10-04-2018 , 04:05   Screen fade turn on / off
Reply With Quote #1

Hello. I want to do that players could choose if they want to see the blue screen fade effect or not.

I need two commands /effecton and /effectoff with which could be turn on or off the screen fade. Turned off should be default option.

And if it is possible, I need option remind in order to when player recconects he would not have to turn on this effect again.

Can anyone help me?

PHP Code:
#include <amxmodx>
#include <fun>

#define PLUGIN "Kill Green Fade"
#define VERSION "1.0"
#define AUTHOR "AMXX Community"

#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new g_iMaxPlayersmsgScreenFadeamx_kill_fade_amountamx_kill_health

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
amx_kill_fade_amount register_cvar("amx_kill_fade_amount""150")
    
amx_kill_health register_cvar("amx_kill_health""0")
    
    
register_event("DeathMsg""death_event""a""1>0")
    
    
msgScreenFade get_user_msgid("ScreenFade")
    
g_iMaxPlayers get_maxplayers()
}

public 
death_event()
{
    new 
iKiller read_data(1)

    if(
IsPlayer(iKiller) && is_user_alive(iKiller))
    {
        
fadegreen(iKillerget_pcvar_num(amx_kill_fade_amount))
        
set_user_health(iKillerget_user_health(iKiller) + get_pcvar_num(amx_kill_health))
    }
}



stock fadegreen(idammount)
{    
    
//FADE OUT FROM GREEN
    
if (ammount 255)
    
ammount 255
    
    message_begin
(MSG_ONE_UNRELIABLEmsgScreenFade, {0,0,0}, id)
    
write_short(ammount 100)    //Durration
    
write_short(0)        //Hold
    
write_short(0)        //Type
    
write_byte(0)    //R
    
write_byte(0)    //G
    
write_byte(255)    //B
    
write_byte(ammount)    //B
    
message_end()
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1063\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by LithuanianJack; 10-04-2018 at 04:12.
LithuanianJack is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 10-04-2018 , 06:27   Re: Screen fade turn on / off
Reply With Quote #2

what if player had it enabled and suddenly dies..should hes screen stay blue or get reseted?
Quote:
Originally Posted by LithuanianJack View Post
And if it is possible, I need option remind in order to when player recconects he would not have to turn on this effect again.
code will require nvault or similar for this...too much for just one bool
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 10-04-2018 , 12:43   Re: Screen fade turn on / off
Reply With Quote #3

No saving, just on / off commands

PHP Code:
#include <amxmodx>
#include <fun>

#define PLUGIN "Kill Green Fade"
#define VERSION "1.0"
#define AUTHOR "AMXX Community"

#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new g_iMaxPlayersmsgScreenFadeamx_kill_fade_amountamx_kill_health
new bool:g_bFadeEnabled[33];
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /effecton""EffectOn")
    
register_clcmd("say /effectoff""EffectOff")
    
    
amx_kill_fade_amount register_cvar("amx_kill_fade_amount""150")
    
amx_kill_health register_cvar("amx_kill_health""0")
    
    
register_event("DeathMsg""death_event""a""1>0")
    
    
msgScreenFade get_user_msgid("ScreenFade")
    
g_iMaxPlayers get_maxplayers()
}

public 
death_event()
{
    new 
iKiller read_data(1)

    if(
IsPlayer(iKiller) && is_user_alive(iKiller))
    {
        if(
g_bFadeEnabled[iKiller]) {
            
fadegreen(iKillerget_pcvar_num(amx_kill_fade_amount))
        }
        
set_user_health(iKillerget_user_health(iKiller) + get_pcvar_num(amx_kill_health))
    }
}

public 
client_putinserver(id) {
    
g_bFadeEnabled[id] = true;
}

public 
EffectOn(id) {
    
g_bFadeEnabled[id] = true;
    
client_print(idprint_chat"[SCREENFADE] Turned on.")
}

public 
EffectOff(id) {
    
g_bFadeEnabled[id] = false;
    
client_print(idprint_chat"[SCREENFADE] Turned off.")
}

stock fadegreen(idamount)
{    
    
//FADE OUT FROM GREEN
    
if (amount 255)
        
amount 255
    
    message_begin
(MSG_ONE_UNRELIABLEmsgScreenFade, {0,0,0}, id)
    
write_short(amount 100)    //Durration
    
write_short(0)        //Hold
    
write_short(0)        //Type
    
write_byte(0)    //R
    
write_byte(0)    //G
    
write_byte(255)    //B
    
write_byte(amount)    //B
    
message_end()
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1063\\ f0\\ fs16 \n\\ par }
*/ 
__________________

Last edited by Airkish; 10-04-2018 at 14:04.
Airkish is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 10-05-2018 , 07:48   Re: Screen fade turn on / off
Reply With Quote #4

Quote:
Originally Posted by Airkish View Post
No saving, just on / off commands

PHP Code:
#include <amxmodx>
#include <fun>

#define PLUGIN "Kill Green Fade"
#define VERSION "1.0"
#define AUTHOR "AMXX Community"

#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new g_iMaxPlayersmsgScreenFadeamx_kill_fade_amountamx_kill_health
new bool:g_bFadeEnabled[33];
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /effecton""EffectOn")
    
register_clcmd("say /effectoff""EffectOff")
    
    
amx_kill_fade_amount register_cvar("amx_kill_fade_amount""150")
    
amx_kill_health register_cvar("amx_kill_health""0")
    
    
register_event("DeathMsg""death_event""a""1>0")
    
    
msgScreenFade get_user_msgid("ScreenFade")
    
g_iMaxPlayers get_maxplayers()
}

public 
death_event()
{
    new 
iKiller read_data(1)

    if(
IsPlayer(iKiller) && is_user_alive(iKiller))
    {
        if(
g_bFadeEnabled[iKiller]) {
            
fadegreen(iKillerget_pcvar_num(amx_kill_fade_amount))
        }
        
set_user_health(iKillerget_user_health(iKiller) + get_pcvar_num(amx_kill_health))
    }
}

public 
client_putinserver(id) {
    
g_bFadeEnabled[id] = true;
}

public 
EffectOn(id) {
    
g_bFadeEnabled[id] = true;
    
client_print(idprint_chat"[SCREENFADE] Turned on.")
}

public 
EffectOff(id) {
    
g_bFadeEnabled[id] = false;
    
client_print(idprint_chat"[SCREENFADE] Turned off.")
}

stock fadegreen(idamount)
{    
    
//FADE OUT FROM GREEN
    
if (amount 255)
        
amount 255
    
    message_begin
(MSG_ONE_UNRELIABLEmsgScreenFade, {0,0,0}, id)
    
write_short(amount 100)    //Durration
    
write_short(0)        //Hold
    
write_short(0)        //Type
    
write_byte(0)    //R
    
write_byte(0)    //G
    
write_byte(255)    //B
    
write_byte(amount)    //B
    
message_end()
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1063\\ f0\\ fs16 \n\\ par }
*/ 
It works, thank you! ;)
LithuanianJack is offline
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

Forum Jump


All times are GMT -4. The time now is 00:34.


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