Raised This Month: $ Target: $400
 0% 

[REQ] Red vision below 25HP


Post New Thread Reply   
 
Thread Tools Display Modes
Joce93
Senior Member
Join Date: Feb 2016
Old 05-19-2016 , 17:36   Re: [REQ] Red vision below 25HP
Reply With Quote #21

Ok, i'm using this script for screen fade:

PHP Code:
#include <amxmodx>
 
#define FADE_HEALTH 25
#define FADE_TYPE 0x0004
#define FADE_R 210
#define FADE_G 00
#define FADE_B 00
#define FADE_ALPHA 20
 
new g_MsgScreenFade;
 
public 
plugin_init()
{
    
register_plugin("Low hp fade","1.0","Nani")
 
    
register_event("Health""Event_Health""be")
    
    
g_MsgScreenFade get_user_msgid("ScreenFade")
}
 
public 
Event_Health(iPlayer)
{
    new 
Health read_data(1);
    
    if(
Health <= FADE_HEALTH)
    {
        
message_begin(MSG_ONE_UNRELIABLEg_MsgScreenFade_iPlayer)
        
write_short(0// duration
        
write_short(0// hold time
        
write_short(FADE_TYPE// fade type
        
write_byte(FADE_R// R
        
write_byte(FADE_G// G
        
write_byte(FADE_B// B
        
write_byte(FADE_ALPHA)
        
message_end()
    }

It works great, BUT when i take a medkit for higher HP (more than 25hp) , i still have the red screen (and even when i die and respawn) I play on sven coop.

Can anyone help me ?
Joce93 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-21-2016 , 10:04   Re: [REQ] Red vision below 25HP
Reply With Quote #22

Use this :

PHP Code:
#include <amxmodx> 
  
#define FADE_HEALTH 25 
#define FADE_TYPE 0x0004 
#define FADE_R 210 
#define FADE_G 00 
#define FADE_B 00 
#define FADE_ALPHA 20 
  
new g_MsgScreenFade
  
public 
plugin_init() 

    
register_plugin("Low hp fade","1.0","Nani"
  
    
register_event("Health""Event_Health""be"
    
register_event("DeathMsg""eDeathMsg""a");
    
    
g_MsgScreenFade get_user_msgid("ScreenFade"

  
public 
Event_Health(iPlayer
    
screenfade(iPlayerread_data(1) <= FADE_HEALTH ?  1

public 
eDeathMsg()
    
screenfade(read_data(2), 1)
    
    
stock screenfade(idparam){
   
message_begin(MSG_ONE_UNRELIABLEg_MsgScreenFade_id
   
write_short(param)  
   
write_short(param)
   
write_short(FADE_TYPE)
   
write_byte(FADE_R
   
write_byte(FADE_G
   
write_byte(FADE_B
   
write_byte(FADE_ALPHA
   
message_end() 

It will stop sf on death or hp bigger than 25.

Last edited by siriusmd99; 05-21-2016 at 12:09.
siriusmd99 is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 05-21-2016 , 10:42   Re: [REQ] Red vision below 25HP
Reply With Quote #23

Quote:
Originally Posted by siriusmd99 View Post
Use this :

PHP Code:
#include <amxmodx> 
  
#define FADE_HEALTH 25 
#define FADE_TYPE 0x0004 
#define FADE_R 210 
#define FADE_G 00 
#define FADE_B 00 
#define FADE_ALPHA 20 
  
new g_MsgScreenFade
  
public 
plugin_init() 

    
register_plugin("Low hp fade","1.0","Nani"
  
    
register_event("Health""Event_Health""be"
    
register_event("DeathMsg""eDeathMsg""a");
    
    
g_MsgScreenFade get_user_msgid("ScreenFade"

  
public 
Event_Health(iPlayer
    
screenfade(iPlayerread_data(1) <= FADE_HEALTH ?  1

public 
eDeathMsg()
    
screenfade(read_data(2), 1)
    
    
stock screenfade(idparam){
   
message_begin(MSG_ONE_UNRELIABLEg_MsgScreenFade_iPlayer
   
write_short(param)  
   
write_short(param)
   
write_short(FADE_TYPE)
   
write_byte(FADE_R
   
write_byte(FADE_G
   
write_byte(FADE_B
   
write_byte(FADE_ALPHA
   
message_end() 

It will stop sf on death or hp bigger than 25.
I tryed but Compile Failed.
Joce93 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-21-2016 , 12:10   Re: [REQ] Red vision below 25HP
Reply With Quote #24

sorry ,i fixed.
It wasn't so hard for you to fix but anyway...
siriusmd99 is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 05-22-2016 , 06:44   Re: [REQ] Red vision below 25HP
Reply With Quote #25

Quote:
Originally Posted by siriusmd99 View Post
sorry ,i fixed.
It wasn't so hard for you to fix but anyway...
I tryed, I have the red fade all the time, not only when <25HP, but when i start to play...
Joce93 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-22-2016 , 07:14   Re: [REQ] Red vision below 25HP
Reply With Quote #26

Because at new round you are given 100 HP, just add hamsandwich module at the top then in plugin_init add ham post spawn event remove fade:

public ham_post_spawn(id)
screenfade( id, 1)
siriusmd99 is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 05-22-2016 , 10:12   Re: [REQ] Red vision below 25HP
Reply With Quote #27

Quote:
Originally Posted by siriusmd99 View Post
Because at new round you are given 100 HP, just add hamsandwich module at the top then in plugin_init add ham post spawn event remove fade:

public ham_post_spawn(id)
screenfade( id, 1)
PHP Code:
#include <amxmodx> 
#include <hamsandwich>
  
#define FADE_HEALTH 25 
#define FADE_TYPE 0x0004 
#define FADE_R 210 
#define FADE_G 00 
#define FADE_B 00 
#define FADE_ALPHA 15 
  
new g_MsgScreenFade
  
public 
plugin_init() 


    
register_plugin("Low hp fade","1.0","Nani"
  
    
register_event("Health""Event_Health""be"
    
register_event("DeathMsg""eDeathMsg""a");
    
    
g_MsgScreenFade get_user_msgid("ScreenFade"

  
public 
Event_Health(iPlayer
    
screenfade(iPlayerread_data(1) <= FADE_HEALTH ?  1

public 
eDeathMsg()
    
screenfade(read_data(2), 1)

public 
ham_post_spawn(id)
    
screenfadeid1)
    
    
stock screenfade(idparam){
   
message_begin(MSG_ONE_UNRELIABLEg_MsgScreenFade_id
   
write_short(param)  
   
write_short(param)
   
write_short(FADE_TYPE)
   
write_byte(FADE_R
   
write_byte(FADE_G
   
write_byte(FADE_B
   
write_byte(FADE_ALPHA
   
message_end() 

It is right ? I still have the fade screen when i start the game,i just want it less than 25hp...
Joce93 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-22-2016 , 11:17   Re: [REQ] Red vision below 25HP
Reply With Quote #28

You forget to add in plugins_init this :

RegisterHam(Ham_Spawn, "player", "ham_post_spawn", 1);
siriusmd99 is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 05-23-2016 , 14:35   Re: [REQ] Red vision below 25HP
Reply With Quote #29

Quote:
Originally Posted by siriusmd99 View Post
You forget to add in plugins_init this :

RegisterHam(Ham_Spawn, "player", "ham_post_spawn", 1);

PHP Code:
#include <amxmodx> 
#include <hamsandwich>
  
#define FADE_HEALTH 25 
#define FADE_TYPE 0x0004 
#define FADE_R 210 
#define FADE_G 00 
#define FADE_B 00 
#define FADE_ALPHA 15 
  
new g_MsgScreenFade
  
public 
plugin_init() 

    
register_plugin("Low hp fade","1.0","Nani"

    
register_event("Health""Event_Health""be"
    
register_event("DeathMsg""eDeathMsg""a");
    
RegisterHam(Ham_Spawn"player""ham_post_spawn"1);
    
    
g_MsgScreenFade get_user_msgid("ScreenFade"

  
public 
Event_Health(iPlayer
    
screenfade(iPlayerread_data(1) <= FADE_HEALTH ?  1

public 
eDeathMsg()
    
screenfade(read_data(2), 1)

public 
ham_post_spawn(id)
    
screenfadeid1)
    
    
stock screenfade(idparam){
   
message_begin(MSG_ONE_UNRELIABLEg_MsgScreenFade_id
   
write_short(param)  
   
write_short(param)
   
write_short(FADE_TYPE)
   
write_byte(FADE_R
   
write_byte(FADE_G
   
write_byte(FADE_B
   
write_byte(FADE_ALPHA
   
message_end() 

So like this ? I have this error message:



Sorry, i don't know anything about coding
Joce93 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-24-2016 , 08:12   Re: [REQ] Red vision below 25HP
Reply With Quote #30

Omg, this is not error. This says that code is not arranged properly. Don't pay attention to it it won't affect the code.This is just a warning that doesn't have consequences on runtime of the plugin.

P.S. I fu**ing try to indent but doesn't work. I click identer on amxx studio and anyway it shows at least 1 warning.
siriusmd99 is offline
Old 06-26-2016, 08:21
Joce93
This message has been deleted by Joce93.
Reply



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:26.


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