AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   team Color Flashbangs help me (https://forums.alliedmods.net/showthread.php?t=63685)

zwfgdlc 11-27-2007 08:58

team Color Flashbangs help me
 
All player's screens are blue when it is played that CT throws away to FLASHBANG;
All player's screens are red when it is played that T throws away to FLASHBANG;
The following is a code, the fault where? Help me!

When the flashbangs of CT has not been exploded yet, if T throws the flashbangs away, then the color is red. . .
How to solve this problem?

PHP Code:

#include <amxmodx>
#include <engine>

#define PLUGIN    "team Color Flashbangs"
#define VERSION    "1.0"
#define AUTHOR    "zwfgdlc"


new g_nMsgScreenFade
new team
public plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
register_event("ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199")
    
g_nMsgScreenFade get_user_msgid("ScreenFade")
}

public 
grenade_throw(idgreindexwpnid)
{
    if(
wpnid==CSW_FLASHBANG)
    
team=get_user_team(id)
}

public 
FlashedEventid )
{
    new 
iRed,iGreen,iBlue
    
if (team==1)
    {
        
iRed 255
        iGreen 
90
        iBlue 
90
    
}else{
        
iRed 125
        iGreen 
125
        iBlue 
=  255        
    
}

    
message_beginMSG_ONE,g_nMsgScreenFade,{0,0,0},id )
    
write_shortread_data) )    // Duration
    
write_shortread_data) )    // Hold time
    
write_shortread_data) )    // Fade type
    
write_byte iRed )        // Red
    
write_byte iGreen )        // Green
    
write_byte iBlue )        // Blue
    
write_byte read_data) )    // Alpha
    
message_end()
    return 
PLUGIN_HANDLED



Pro Patria Finland 11-27-2007 09:07

Re: team Color Flashbangs help me
 
It doesn't work because the team variable is changed when the a T throws a nade after the CT.

It would be hard to get around that, but it's still possible to make it more accurate by making a timer of some sort.

zwfgdlc 11-27-2007 09:22

Re: team Color Flashbangs help me
 
If use the function " set _ pev(greindex, pev _ team, get _ user _ team(id) )"
In this way how to do?

purple_pixie 11-27-2007 09:54

Re: team Color Flashbangs help me
 
You would then have to get the ent-id of the flash that blinded the player, though ...

It's not going to be easy.

Gimme a minute.

EDIT: Try this (requires AMX X 1.8 )

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN    "team Color Flashbangs"
#define VERSION    "1.0"
#define AUTHOR    "zwfgdlc"


new g_nMsgScreenFade
new team

public plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
register_event("ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199")
    
g_nMsgScreenFade get_user_msgid("ScreenFade")
    
RegisterHam(Ham_Think,"grenade","on_nadethink")
}
public 
on_nadethink(id)
{
    
team pev(id,pev_team) ;
}
public 
grenade_throw(idgreindexwpnid)
{
    if(
wpnid==CSW_FLASHBANG)
    
set_pev(greindex,pev_team,pev(id,pev_team))
}

public 
FlashedEventid )
{
    new 
iRed,iGreen,iBlue
    
if (team==1)
    {
        
iRed 255
        iGreen 
90
        iBlue 
90
    
}else{
        
iRed 125
        iGreen 
125
        iBlue 
=  255        
    
}

    
message_beginMSG_ONE,g_nMsgScreenFade,{0,0,0},id )
    
write_shortread_data) )    // Duration
    
write_shortread_data) )    // Hold time
    
write_shortread_data) )    // Fade type
    
write_byte iRed )        // Red
    
write_byte iGreen )        // Green
    
write_byte iBlue )        // Blue
    
write_byte read_data) )    // Alpha
    
message_end()
    return 
PLUGIN_HANDLED


No idea if it will work.

zwfgdlc 11-27-2007 13:52

Re: team Color Flashbangs help me
 
What I use now is AMXX1.76, can AMXX1.76 be realized ?

Alka 11-27-2007 14:00

Re: team Color Flashbangs help me
 
Yeah, but you must put on you'r server "hamsandwich" module...

zwfgdlc 11-27-2007 14:17

Re: team Color Flashbangs help me
 
No " hamsandwich" Module, is that all right to realize

purple_pixie 11-28-2007 08:11

Re: team Color Flashbangs help me
 
Not quite sure what you mean by "realise" ...

I could possibly rewrite it to use engine instead of FakeMeta and HamSandiwch, but I have no experience with engine.

Install HamSandwich from this thread
Or upgrade to 1.8


All times are GMT -4. The time now is 11:10.

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