Raised This Month: $51 Target: $400
 12% 

Solved Remove "DEAD" flag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-25-2018 , 17:18   Remove "DEAD" flag
Reply With Quote #1

Hi, I've been going thru some issues with my latest code, I'm unable to remove the 'DEAD' flag from scoreboard for some reason, and I'm trying to do something: When Player1 infects Player2 it should show up in the kill-feed like this:

Player1 ☠️ Player2 or Player1 ☠️ Player2

Player2 color depending on his team, but instead it's always showing:
Player1 ☠️ Player2

PS: TEAM_MONSTER == 2 (TEAM_CT)

PHP Code:
InfectPlayeriVictimiAttacker )
{
    
InfectionMsgiVictimiAttacker );

    
cs_set_user_teamiVictimTEAM_MONSTER );
    
g_iPlayerTeamiVictim ] = TEAM_MONSTER;
    
    
RemoveDeadFlagiVictim );
}

RemoveDeadFlagiPlayer )
{
    
message_beginMSG_ALLg_iMsgScoreAttrib 
    { 
        
write_byteiPlayer 
        
write_byte
        
message_end( ) 
    }
}

InfectionMsgiVictimiAttacker )
{
    
message_beginMSG_BROADCASTg_iMsgDeath )
    
write_byteiAttacker // killer
    
write_byteiVictim // victim
    
write_byte// headshot flag
    
write_string"infection" // killer's weapon
    
message_end( )

__________________

Last edited by edon1337; 11-29-2018 at 17:00.
edon1337 is offline
Old 11-26-2018, 05:45
Natsheh
This message has been deleted by Natsheh. Reason: Nvm waste of time
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-29-2018 , 17:00   Re: Remove "DEAD" flag
Reply With Quote #2

Here's the answer on how to solve the issues in case someone needs them since nobody helped me:

1. All I had to do to remove the "DEAD" flag was change MSG_ALL to MSG_BROADCAST for some reason.
2. Creating a 0.1s task after sending Infection Message and then changing the player team inside the task will make it work, the reason:

When you send infection message it is called twice, not sure about the in-between delay of the messages though. So:

• Attacker is CT, victim is T
• You send infection message
• Right message is sent, CT attacker kills T victim
• Victim team is changed to CT
• Message is sent again with changed teams (both CT)
That's why it always showed victim team CT.
__________________

Last edited by edon1337; 11-29-2018 at 17:01.
edon1337 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-29-2018 , 18:14   Re: Remove "DEAD" flag
Reply With Quote #3

Thanks for posting your solution. FWIW, I did try but it was not working for me so I didn't bother to reply. I dug up this thread which was of no help.
__________________
Bugsy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-30-2018 , 08:09   Re: Remove "DEAD" flag
Reply With Quote #4

Quote:
Originally Posted by Bugsy View Post
Thanks for posting your solution. FWIW, I did try but it was not working for me so I didn't bother to reply. I dug up this thread which was of no help.
Thanks for your time.
I'm still not sure what's causing it to get called twice though.
__________________
edon1337 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-30-2018 , 10:17   Re: Remove "DEAD" flag
Reply With Quote #5

What do you mean by twice
__________________
Bugsy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-30-2018 , 10:36   Re: Remove "DEAD" flag
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
What do you mean by twice
I debugged and DeathMsg was sent twice, first is because of what I sent manually but the second one?
__________________
edon1337 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-30-2018 , 19:04   Re: Remove "DEAD" flag
Reply With Quote #7

InfectionMsg() does not trigger the actual DeathMsg event..if you hook DeathMsg and call InfectionMsg(), DeathMsg is not called. I would need to see more of your code.
__________________
Bugsy is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 12-01-2018 , 12:05   Re: Remove "DEAD" flag
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
InfectionMsg() does not trigger the actual DeathMsg event..if you hook DeathMsg and call InfectionMsg(), DeathMsg is not called. I would need to see more of your code.
My bad, I was thinking InfectionMsg was somehow called twice, but now I see it's not.
So what's the reason I have to set a 0.1 second delay to make it work properly?

When I don't set a 0.1s delay it shows always CT, but when I set a 0.1s delay, it shows the right team.

Works:
PHP Code:
InfectPlayeriVictimiAttacker )
{    
    
InfectionMsgiVictimiAttacker );
    
set_task0.1"DelayedTeamChange"iVictim TASK_TEAM_DELAY );
}

public 
DelayedTeamChangeiVictim )
{
    
iVictim -= TASK_TEAM_DELAY;

    
cs_set_user_teamiVictimTEAM_MONSTER );
    
g_iPlayerTeamiVictim ] = TEAM_MONSTER;
    
    
RemoveDeadFlagiVictim );

Doesn't work:
PHP Code:
InfectPlayeriVictimiAttacker )
{    
    
InfectionMsgiVictimiAttacker );
    
    
cs_set_user_teamiVictimTEAM_MONSTER );
    
g_iPlayerTeamiVictim ] = TEAM_MONSTER;
    
    
RemoveDeadFlagiVictim );

__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-01-2018 , 13:08   Re: Remove "DEAD" flag
Reply With Quote #9

Things don't happen instantly, so DeathMsg is likely processed by the game after the team change you made. Setting the task delays the team change after DeathMsg was sent.
__________________

Last edited by HamletEagle; 12-01-2018 at 13:09.
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 12-01-2018 , 13:39   Re: Remove "DEAD" flag
Reply With Quote #10

Quote:
Originally Posted by HamletEagle View Post
Things don't happen instantly, so DeathMsg is likely processed by the game after the team change you made. Setting the task delays the team change after DeathMsg was sent.
Yeah that must be it.
__________________
edon1337 is offline
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 21:53.


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