Raised This Month: $ Target: $400
 0% 

team Color Flashbangs help me


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zwfgdlc
Senior Member
Join Date: May 2006
Old 11-27-2007 , 08:58   team Color Flashbangs help me
Reply With Quote #1

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

zwfgdlc is offline
Pro Patria Finland
Senior Member
Join Date: Apr 2006
Location: BaronPub.com
Old 11-27-2007 , 09:07   Re: team Color Flashbangs help me
Reply With Quote #2

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.
__________________
I am not a number. I am Gordon Freeman!
Pro Patria Finland is offline
zwfgdlc
Senior Member
Join Date: May 2006
Old 11-27-2007 , 09:22   Re: team Color Flashbangs help me
Reply With Quote #3

If use the function " set _ pev(greindex, pev _ team, get _ user _ team(id) )"
In this way how to do?
zwfgdlc is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 11-27-2007 , 09:54   Re: team Color Flashbangs help me
Reply With Quote #4

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.

Last edited by purple_pixie; 11-27-2007 at 09:58.
purple_pixie is offline
zwfgdlc
Senior Member
Join Date: May 2006
Old 11-27-2007 , 13:52   Re: team Color Flashbangs help me
Reply With Quote #5

What I use now is AMXX1.76, can AMXX1.76 be realized ?
zwfgdlc is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 11-27-2007 , 14:00   Re: team Color Flashbangs help me
Reply With Quote #6

Yeah, but you must put on you'r server "hamsandwich" module...
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
zwfgdlc
Senior Member
Join Date: May 2006
Old 11-27-2007 , 14:17   Re: team Color Flashbangs help me
Reply With Quote #7

No " hamsandwich" Module, is that all right to realize
zwfgdlc is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 11-28-2007 , 08:11   Re: team Color Flashbangs help me
Reply With Quote #8

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
purple_pixie 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 11:10.


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