AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help with screenfade (https://forums.alliedmods.net/showthread.php?t=88975)

alan_el_more 03-31-2009 09:34

help with screenfade
 
i have this plugin
PHP Code:

#include <amxmodx>
#include <zombieplague>

new g_msgScreenFadecvar_togglecvar_humanoscvar_zombiescvar_rounddraw

public plugin_init()
{
    
register_plugin("[ZP] ScreenFade""1.3""alan_el_more")
    
g_msgScreenFade get_user_msgid("ScreenFade")
    
cvar_toggle register_cvar("zp_screenfade""1")
    
cvar_humanos register_cvar("zp_screenfade_humanos""1")
    
cvar_zombies register_cvar("zp_screenfade_zombies""1")
    
cvar_rounddraw register_cvar("zp_screenfade_rounddraw""1")
}

public 
zp_round_ended(winteam)
{
    if (
get_pcvar_num(cvar_toggle))
    {
        if ((
get_pcvar_num(cvar_humanos)) && winteam == WIN_HUMANS
        {
            
screenfade(00255)
        }
        if ((
get_pcvar_num(cvar_zombies)) && winteam == WIN_ZOMBIES
        {
            
screenfade(25500)
        }
        if ((
get_pcvar_num(cvar_rounddraw)) && winteam == WIN_NO_ONE
        {
            
screenfade(02550)
        }
    }
}

public 
screenfade(redgreenblue)
{
    
message_begin(MSG_BROADCASTg_msgScreenFade)
    
write_short((1<<12)*4)
    
write_short((1<<12)*1)
    
write_short(0x0001
    
write_byte (red)
    
write_byte (green)
    
write_byte (blue)
    
write_byte (250)
    
message_end()


my questions are...
how do i determine the color of each screenfade with a cvar for each?
and
how do i that the color of screenfade is solid or opaque?

thanks in advance :)

SnoW 03-31-2009 09:55

Re: help with screenfade
 
Quote:

Originally Posted by alan_el_more (Post 793993)
how do i determine the color of each screenfade with a cvar for each?

From Jim's grenade trail:
PHP Code:

   get_pcvar_string(nadecolor9)
   new 
str_to_num(color)
   
1000000
   c 
%= 1000000 
   g 
1000
   b 
1000 


Dr.G 03-31-2009 09:59

Re: help with screenfade
 
yes as snow says that would be the best, but a simple way, thats easy could be like this:

PHP Code:

#include <amxmodx>
#include <zombieplague>
 
new g_msgScreenFadecvar_togglecvar_humanoscvar_zombiescvar_rounddraw
 
new cvar_color_one
new cvar_color_two
new cvar_color_three
 
public plugin_init()
{
 
register_plugin("[ZP] ScreenFade""1.3""alan_el_more")
 
g_msgScreenFade get_user_msgid("ScreenFade")
 
cvar_toggle register_cvar("zp_screenfade""1")
 
cvar_humanos register_cvar("zp_screenfade_humanos""1")
 
cvar_zombies register_cvar("zp_screenfade_zombies""1")
 
cvar_rounddraw register_cvar("zp_screenfade_rounddraw""1")
 
 
cvar_color_one register_cvar("zp_screenfade_color_one""0")
 
cvar_color_two register_cvar("zp_screenfade_color_two""0")
 
cvar_color_threeregister_cvar("zp_screenfade_color_three""256")
}
 
public 
zp_round_ended(winteam)
{
 if (
get_pcvar_num(cvar_toggle))
 {
  if ((
get_pcvar_num(cvar_humanos)) && winteam == WIN_HUMANS
  {
   
screenfade(get_pcvar_num(cvar_color_one), get_pcvar_num(cvar_color_two), get_pcvar_num(cvar_color_three))
  }
  if ((
get_pcvar_num(cvar_zombies)) && winteam == WIN_ZOMBIES
  {
   
screenfade(get_pcvar_num(cvar_color_one), get_pcvar_num(cvar_color_two), get_pcvar_num(cvar_color_three))
  }
  if ((
get_pcvar_num(cvar_rounddraw)) && winteam == WIN_NO_ONE
  {
   
screenfade(get_pcvar_num(cvar_color_one), get_pcvar_num(cvar_color_two), get_pcvar_num(cvar_color_three))
  }
 }
}
 
public 
screenfade(redgreenblue)
{
 
message_begin(MSG_BROADCASTg_msgScreenFade)
 
write_short((1<<12)*4)
 
write_short((1<<12)*1)
 
write_short(0x0001
 
write_byte (red)
 
write_byte (green)
 
write_byte (blue)
 
write_byte (250)
 
message_end()



alan_el_more 03-31-2009 10:11

Re: help with screenfade
 
@Snow
do Something more simple?

@DR.G
i want the color of one screenfade be changed to one cvar, not 3
for example:
zp_screenfade_zombies 255000000

Dr.G 03-31-2009 11:06

Re: help with screenfade
 
then you have to do like snow says. find Jim's grenade trail plugin and see how the values are passed on

alan_el_more 03-31-2009 11:23

Re: help with screenfade
 
sorry but do not understand the code
does any other way?

ConnorMcLeod 03-31-2009 12:23

Re: help with screenfade
 
For transparency, set the last param (actually 250)
See my stock : http://forums.alliedmods.net/showthread.php?t=87623


All times are GMT -4. The time now is 02:15.

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