AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Kill while flashbanged (https://forums.alliedmods.net/showthread.php?t=293176)

EFFx 01-25-2017 02:29

Kill while flashbanged
 
I'm trying to check if a player has killed someone while flashbanged.

Thats the best way to do this?

PHP Code:

public msgScreenFade(iMessageIDiMessageDestinityiEntity)
{    
    const 
MIN_AMMOUNT 100
    
    
if(get_msg_arg_int(4) >= MIN_AMMOUNT 
    
&& get_msg_arg_int(5) >= MIN_AMMOUNT 
    
&& get_msg_arg_int(6) >= MIN_AMMOUNT 
    
&& get_msg_arg_int(7) > 0xC7// I also don't know what it means, someone explain?
    
{
        
PlayerData[iEntity][arPlayerBlinded] = true
        
        
if(task_exists(iEntity+TASK_NOTBLIND))
            
remove_task(iEntity+TASK_NOTBLIND)
            
        
set_task(5.0,"userIsNotBlindAnymore",iEntity+TASK_NOTBLIND)
    }
}

public 
userIsNotBlindAnymore(playerID)
{
    new 
id playerID TASK_NOTBLIND
    
    PlayerData
[id][arPlayerBlinded] = false


And

PHP Code:

public DeathMsg()
{
    new 
iKiller read_data(1)

    if(
PlayerData[iKiller][arPlayerBlinded)
    {
        
// bla bla bla
    
}



PRoSToTeM@ 01-25-2017 04:11

Re: Kill while flashbanged
 
You can calculate set_task time from duration and holdtime parameters.
Also you can check blind directly via private data, code from gamedll:
PHP Code:

float endTime pPlayer->m_blindFadeTime pPlayer->m_blindHoldTime pPlayer->m_blindStartTime;

if (
gpGlobals->time endTime)
{
  
// Player is blind, but he can be not fully blind 

I'm not sure, but I think that m_blindUntilTime should check full blind:
PHP Code:

if (gpGlobals->time pPlayer->m_blindUntilTime)
{
  
// Player is fully blind 


EFFx 01-25-2017 19:25

Re: Kill while flashbanged
 
Yea, I thinked about calculate the time of set_task with parameters, but I don't know, I've used a debug for these parameters, thats what I got:

Code:

get_msg_arg_int(1), get_msg_arg_int(2), get_msg_arg_int(3)
(1): 40496, (2): 8999, (3): 0 - Ahead
(1): 20989, (2): 3426, (3): 0 - Behind

And another thing, I want not make another thread about this.

I'm trying to pick the defuse time, like CSGO messages - "EFFx has defused the bomb with 0.3 seconds remaining"

Thats what I have:
PHP Code:

new Float:fC4TimeFloat:fC4DefuseFloat:fTimeResult

public bomb_planted(id)
{
   
fC4Time get_gametime()
}
public 
bomb_defused(id)
{
   
fC4Defuse get_gametime()

   
fTimeResult fC4Defuse fC4Time
   console_print
(id,"Defuse Time: %0.1f",fTimeResult)


input:

Code:

Defuse Time: 41.1 - mp_c4time is 45

SpannerSpammer 01-26-2017 02:04

Re: Kill while flashbanged
 
ScreenFade user message and flags:
Code:

// (HL) Screen Fade type flags
#define FFADE_IN                        0x0000                // Just here so we don't pass 0 into the function
#define FFADE_OUT                        0x0001                // Fade out (not in)
#define FFADE_MODULATE                0x0002                // Modulate (don't blend)
#define FFADE_STAYOUT                0x0004                // ignores the duration, stays faded out until new ScreenFade message received

message_begin( MSG_ONE, gmsgFade, _, id );        // use the magic #1 for "one client"
write_short( duration );                        // fade lasts this long
write_short( holdtime );                        // fade lasts this long
write_short( fadeflags );                        // fade type (in / out)
write_byte( r );                                // fade red
write_byte( g );                                // fade green
write_byte( b );                                // fade blue
write_byte( a );                                // fade alpha / brightness
message_end();

Duration and holdtime parameters are scaled by 4096 and
sent as an unsigned short interger (0 - 65535). Reverse that
process to get the original values for your plugin. Well, sort of,
the values sent might have been truncated in the conversion
(float->int) or clamped to an unsigned short interger range.

Note: If FFADE_STAYOUT flag is set then the player stays blinded
until another screenfade msg is sent and overrides the current one.
This is not applicable to flashbang grenades though.

PRoSToTeM@ 01-26-2017 17:50

Re: Kill while flashbanged
 
PHP Code:

if (get_gametime() < get_ent_data_float(iKiller"CBasePlayer""m_blindUntilTime"))
{
  
// Player is fully blind 


EFFx 01-26-2017 17:54

Re: Kill while flashbanged
 
i'm not checking if the player is fully blind. I don't updated the code, but on the (7) parameter, i'm checking if the value is more than 200, that value is the only I got when the flash explodes behind me, from my side or the front.

PRoSToTeM@ 01-26-2017 21:50

Re: Kill while flashbanged
 
Try to check it in work.

EFFx 01-26-2017 22:15

Re: Kill while flashbanged
 
Dude, what include have this get_ent_data_float()? I got error with that native.

And can someone explain me about the defuse remaining time?

klippy 01-27-2017 07:51

Re: Kill while flashbanged
 
Quote:

Originally Posted by EFFx (Post 2490192)
Dude, what include have this get_ent_data_float()? I got error with that native.

That's a native that's only available in 1.8-3-dev, since #284. It's in fakemeta. It's a much better version of pdata natives.

EFFx 01-27-2017 16:05

Re: Kill while flashbanged
 
But if have someone thats not using 1.8.3 like me? Will that format works?


All times are GMT -4. The time now is 20:58.

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