Raised This Month: $ Target: $400
 0% 

[REQ] Detect no kill and punish ( Players which is not killing the enemies)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-29-2018 , 10:51   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #1

Quote:
Originally Posted by Natsheh View Post
PHP Code:
bool:IsInLineOfSightent1 ent2 

    new 
iTrace Float:fFractionFloat:fOrigin1[3], Float:fOrigin2[3], Float:fViewOfs[3]; 
    
pev(ent1pev_v_ofsfViewOfs);
    
pev(ent1pev_originfOrigin1)
    
fOrigin1 += fViewOfs;
    
pev(ent2pev_v_ofsfViewOfs);
    
pev(ent2pev_originfOrigin2)
    
fOrigin2 += fViewOfs;
    
engfuncEngFunc_TraceLine fOrigin1 fOrigin2 IGNORE_MONSTERS iTrace ); 
    
get_tr2iTrace TR_flFraction fFraction ); 
     
    return 
bool:( fFraction == 1.0 ); 

Now its more accurate.
Can you please explain what exactly this does in comparison to the function I created? I am seeing no difference while in game.

Also, it's not compiling.
Code:
//pev_v_ofs undefined, should this be pev_view_ofs? pev( ent1 , pev_v_ofs , fViewOfs ); pev( ent1 , pev_origin , fOrigin1 ) //You cannot do this with arrays. fOrigin1 += fViewOfs; //Should each index of the array be incremented? fOrigin1[ 0 ] += fViewOfs[ 0 ]; fOrigin1[ 1 ] += fViewOfs[ 1 ]; fOrigin1[ 2 ] += fViewOfs[ 2 ];
__________________

Last edited by Bugsy; 04-29-2018 at 10:58.
Bugsy is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 04-28-2018 , 17:47   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #2

Bug Report : False Detection If The Player Shoot Than Run Away..
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-28-2018 , 20:44   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #3

Quote:
Originally Posted by Old.School View Post
Bug Report : False Detection If The Player Shoot Than Run Away..
Need more info. If he LOOKS away then the counter resets. But if he runs away, backwards, looking at the enemy then he is technically still no shooting.

The below has reset counter on primary attack. Untested
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

new const Version[] = "0.4";

#define TESTING

#define MAX_PLAYERS 32

const m_fInReload 54;
const 
XO_Weapon 4;

enum DistanceFactor
{
    
Float:DistanceStart,
    
Float:DistanceEnd,
    
Duration
}

new 
g_ThinkingEntity;
new 
g_LastEyeContactMAX_PLAYERS ][ MAX_PLAYERS ];

new const 
DistanceDuration[][ DistanceFactor ] = 
{
    { 
2000.0 99999.0 18 },
    { 
1000.0 1999.9 15 },
    { 
500.0 999.9 10 },
    { 
0.0 499.9 }
};
        
const 
Ignore_Weapons = ( ( << CSW_KNIFE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE ) | ( << CSW_C4 ) );
const 
Do_Not_Reload = ( ( << CSW_KNIFE ) | ( << CSW_C4 ) | ( << CSW_HEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE ) );

public 
plugin_init() 
{
    
register_plugin"No-Kill Punishment" Version "bugsy" );
    
    
register_event"DeathMsg" "EventDeathMsg" "a" );
    
register_logevent"RoundEnd" "1=Round_End" );

    for ( new 
CSW_P228 szWeaponName20 ] ; <= CSW_P90 i++ )
    {
        if ( 
!= )
        {
            
get_weaponnameszWeaponName charsmaxszWeaponName ) );
            
RegisterHamHam_Weapon_PrimaryAttack szWeaponName "HamPrimaryAttack" );
            
            if( !( 
Do_Not_Reload & ( << i  ) ) )
            {
                
RegisterHamHam_Weapon_Reload szWeaponName "HamWeaponReload" true );
            }
        }
    }
    
    
CreateEntity();
}

public 
client_disconnectid )
{
    
ResetPlayerid );
}

public 
EventDeathMsg()
{
    
ResetPlayerread_data) );
}

public 
RoundEnd()
{
    new 
iPlayers32 ] , iNum;
    
    
get_playersiPlayers iNum "a" );
    
    for ( new 
iNum i++ )
    {
        
ResetPlayeriPlayers] );
    }
}

public 
HamWeaponReload( const iWeapon )
{
    if ( 
get_pdata_intiWeapon m_fInReload XO_Weapon ) )
    {
        
ResetPlayerpeviWeapon pev_owner ) );
    }
}

public 
HamPrimaryAttack( const iWeapon )
{
    
ResetPlayerpeviWeapon pev_owner ) );
}

public 
ViewEntity_ThinkiEntity )
{
    new 
iPlayers32 ] , iNum Float:fOrigin] , Float:fEnemyOrigin] , iPlayer iEnemyszName32 ] , szEnemyName32 ] , iPosiThresholdSeconds iSysTime;
    
    
get_playersiPlayers iNum "a" );
    
    if ( 
iNum )
    {
        for ( new 
iNum i++ )
        {
            
iPlayer iPlayers];
            
            for ( new 
iNum p++ )
            {
                
iEnemy iPlayers];
                
                
#if defined TESTING
                //While testing this will force bots on the opposite team to only have and hold the glock.
                //If this is made an ignore weapon then you must change this to a different weapon.
                
if ( is_user_botiEnemy ) && ( get_user_weaponiEnemy ) != CSW_GLOCK18 ) )
                {
                    
strip_user_weaponsiEnemy );
                    
give_itemiEnemy "weapon_glock" );
                    
client_cmdiEnemy "slot2;+attack;wait;-attack" );
                }
                
#endif
                
                
if ( ( iPlayer != iEnemy ) && ( cs_get_user_teamiPlayer ) != cs_get_user_teamiEnemy ) ) )
                {
                    
entity_get_vectoriEnemy EV_VEC_origin fEnemyOrigin );
                    
                    if ( !( 
Ignore_Weapons & ( << get_user_weaponiPlayer ) ) ) && is_in_viewconeiPlayer fEnemyOrigin ) )
                    {
                        
entity_get_vectoriPlayer EV_VEC_origin fOrigin );
                
                        if ( 
IsInLineOfSightfOrigin fEnemyOrigin ) )
                        {
                            if ( !
g_LastEyeContactiPlayer ][ iEnemy ] )
                            {
                                
g_LastEyeContactiPlayer ][ iEnemy ] = get_systime();
                            }
                            
#if defined TESTING
                            
else
                            {
                                
get_user_nameiPlayer szName charsmaxszName ) );
                                
get_user_nameiEnemy szEnemyName charsmaxszEnemyName ) );
                                
client_printprint_chat "%s CAN SEE %s - %d SECONDS" szName szEnemyName , ( get_systime() - g_LastEyeContactiPlayer ][ iEnemy ] ) );
                            }
                            
#endif
                        
}
                        
#if defined TESTING
                        
else
                        {
                            if ( 
g_LastEyeContactiPlayer ][ iEnemy ] )
                            {
                                
get_user_nameiPlayer szName charsmaxszName ) );
                                
get_user_nameiEnemy szEnemyName charsmaxszEnemyName ) );
                                
client_printprint_chat "%s NO LONGER LOOKING AT %s" szName szEnemyName );
                                
g_LastEyeContactiPlayer ][ iEnemy ] = 0;
                            }
                        }
                        
#endif
                    
}
                    else
                    {
                        
#if defined TESTING
                        
if ( g_LastEyeContactiPlayer ][ iEnemy ] )
                        {
                            
get_user_nameiPlayer szName charsmaxszName ) );
                            
get_user_nameiEnemy szEnemyName charsmaxszEnemyName ) );
                            
client_printiPlayer print_chat "%s NO LONGER LOOKING AT %s" szName szEnemyName );
                        }
                        
#endif
                        
                        
g_LastEyeContactiPlayer ][ iEnemy ] = 0;
                    }
                }
            }
        }
        
        
iSysTime get_systime();
        
        
iThresholdSeconds GetDistanceDurationget_distance_ffOrigin fEnemyOrigin ) );
        
        for ( new 
iNum i++ )
        {
            
iPlayer iPlayers];
            
iPos 0;
            
            for ( new 
iNum p++ )
            {
                
iEnemy iPlayers];
                
                
entity_get_vectoriPlayer EV_VEC_origin fOrigin );
                
entity_get_vectoriEnemy EV_VEC_origin fEnemyOrigin );
                
                
iThresholdSeconds GetDistanceDurationget_distance_ffOrigin fEnemyOrigin ) );
                
                if ( ( 
iPlayer != iEnemy ) && g_LastEyeContactiPlayer ][ iEnemy ] && ( ( iSysTime g_LastEyeContactiPlayer ][ iEnemy ] ) >= iThresholdSeconds ) )
                {
                    
iPos += get_user_nameiEnemy szEnemyNameiPos ] , charsmaxszEnemyName ) - iPos );
                    
iPos += copyszEnemyNameiPos ] , charsmaxszEnemyName ) - iPos ", " );
                    
                    
g_LastEyeContactiPlayer ][ iEnemy ] = 0;
                }
            }
            
            if ( 
iPos )
            {
                
get_user_nameiPlayer szName charsmaxszName ) );
                
user_killiPlayer );
                
                
szEnemyNameiPos ] = EOS;
                
client_printprint_chat "* Killed %s for No-Killing [ %s ] !" szName szEnemyName );
            }
        }
    }
    
    
entity_set_floatg_ThinkingEntity EV_FL_nextthink get_gametime() + 1.0 );
}

bool:IsInLineOfSightFloat:fOrigin1] , Float:fOrigin2] )
{
    new 
iTrace Float:fFraction;
    
    
engfuncEngFunc_TraceLine fOrigin1 fOrigin2 IGNORE_MONSTERS iTrace );
    
get_tr2iTrace TR_flFraction fFraction );
    
    return 
bool:( fFraction == 1.0 );
}

ResetPlayerid )
{
    
arraysetg_LastEyeContactid ] , sizeofg_LastEyeContact[] ) );
}

GetDistanceDurationFloat:fDistance )
{
    new 
iDuration 10;
    
    for ( new 
sizeofDistanceDuration ) ; i++ )
    {
        if ( 
DistanceDuration][ DistanceStart ] <= fDistance <= DistanceDuration][ DistanceEnd ] )
        {
            
iDuration DistanceDuration][ Duration ];
        }
    }
    
    return 
iDuration;
}

CreateEntity()
{
    
g_ThinkingEntity create_entity"info_target" );
    
entity_set_stringg_ThinkingEntity EV_SZ_classname "view_entity" );
    
register_think"view_entity" "ViewEntity_Think" );
    
entity_set_floatg_ThinkingEntity EV_FL_nextthink get_gametime() + 1.0 );

__________________

Last edited by Bugsy; 04-28-2018 at 20:48.
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-29-2018 , 13:11   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #4

Still its not quite right you need to loop target size to see if his leg, head,arm , or whole body is spotted. And yes.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-29-2018 , 13:56   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #5

I don't think being that specific is necessary, right? Doing some testing with bots it appears to be accurate enough. In what aspect is the current method not accurate? The fact that he cannot see the entire players body?
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-29-2018 , 14:10   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
I don't think being that specific is necessary, right? Doing some testing with bots it appears to be accurate enough. In what aspect is the current method not accurate? The fact that he cannot see the entire players body?
What if the target was crouching behind a wall has it same height and the target couldnt been seen, but his origin postion is reveled
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 04-29-2018 at 14:11.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-29-2018 , 14:19   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #7

If player A is couching behind a box preventing him from seeing player B, or vice versa, then it technically is not a no shoot.
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-29-2018 , 14:26   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #8

Let me explain more lets say player A looking at player B origin position (Player A cant see player B neither player B can see PLAYER A) but player A can see player B origin would this slap/slay player A for not killing player B.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-29-2018 , 14:28   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #9

What do you mean by looking at origin? IMO, it only matters if player A can see player B, not player A can see location where player B might be hiding. OP, can you weigh in?
__________________

Last edited by Bugsy; 04-29-2018 at 14:28.
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-29-2018 , 14:35   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #10

Does the origin changes when the player change from standing to crouching?

If yes then nvm to what i said.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 04-29-2018 at 14:35.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 09:16.


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