Raised This Month: $32 Target: $400
 8% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 04-13-2018 , 14:46   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #31

i think u need to ignore when player using knife
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Old 04-14-2018, 10:37
Bugsy
This message has been deleted by Bugsy.
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-14-2018 , 11:42   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #32

This version is much better than the original and includes ignore weapons.

Original: Both players need to be looking at each other for threshold seconds for a punishment to happen to both.

New: Detection is done at individual player level so if player A can see player B, regardless of where player B is looking, player A will get punished after the threshold seconds. The seconds counter is reset to 0 if player A looks away or if player A switches to an ignore weapon (knife, c4, smoke, flashbang).

Edit: Applied a small fix for something I accidentally left in there from the previous version.
Edit2: Will now display multiple enemy names if the player was looking at multiple players which resulted in him being killed. "* Killed bugsy for No-Killing [ bot1, bot2, bot3 ]". Also increased the entity next-think from 0.1 to 1.0 which is more efficient.
PHP Code:

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

new const Version[] = "0.3";

#define TESTING

#define MAX_PLAYERS 32

new g_ThinkingEntity;
new 
g_LastEyeContactMAX_PLAYERS ][ MAX_PLAYERS ];
new 
g_pSightThreshold;

const 
Ignore_Weapons = ( ( << CSW_KNIFE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE ) | ( << CSW_C4 ) );

public 
plugin_init() 
{
    
register_plugin"No-Kill Punishment" Version "bugsy" );
    
    
register_event"DeathMsg" "EventDeathMsg" "a" );
    
    
g_pSightThreshold register_cvar"nkp_sightthresholdseconds" "10" );

    
CreateEntity();
}

public 
client_disconnectid )
{
    
ResetPlayerid );
}

public 
EventDeathMsg()
{
    
ResetPlayerread_data) );
}

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 get_pcvar_numg_pSightThreshold );
        
        for ( new 
iNum i++ )
        {
            
iPlayer iPlayers];
            
iPos 0;
            
            for ( new 
iNum p++ )
            {
                
iEnemy iPlayers];
                
                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[] ) );
}

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-15-2018 at 11:02.
Bugsy is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 04-19-2018 , 21:12   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #33

2 bug reports :
-false detect when player when round end with c4 for example and the player was looking /shooting the enemy than auto punish at round start...
-false detect when shooting by only one shoot every one/two seconds cause of distance means when the player crosshair go up of the enemy cause of distance..
__________________
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-19-2018 , 21:25   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #34

My ideas to fix these:

1. I will fix to reset counter at round start. Should I add a radius variable to bombsite if player team is T? This way if T is within X units from bombsite he cannot be punished.
2. Should timer restart with every shot fired?

Do these suggestions work, or do you suggest something else? The more info you give the more I can make this better.
__________________

Last edited by Bugsy; 04-19-2018 at 21:32.
Bugsy is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 04-19-2018 , 22:02   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #35

i guess yes and i think u should added check method if the player is walking so u can avoid player troll following kill false detection maybe
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !

Last edited by Old.School; 04-19-2018 at 22:09.
Old.School is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-19-2018 , 22:20   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #36

So if a player moves at all, reset timer?
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-20-2018 , 04:24   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #37

Bugsy it will be better if you used max size and min size addition , also what if the two players are looking at each other throw something and the origin pos is covered.
__________________
@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-20-2018 at 04:25.
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-20-2018 , 07:51   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #38

I am not sure what you are referring to regarding max size and min size.

And yeah this isn't a 100% perfect solution, I'm not familiar with the intent/purpose of this plugin to be honest so I started with bare bones from what i understood. As I understand better and get feedback I can make tweaks.
__________________
Bugsy is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 04-20-2018 , 19:48   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #39

Quote:
Originally Posted by Bugsy View Post
So if a player moves at all, reset timer?
no cause "if the player is walking" means player using SHIFT Button to stop making any voice to walk rear of the enemy than knife him or kill him with only one shot or some troll somethings like that..
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !

Last edited by Old.School; 04-20-2018 at 19:54. Reason: explained
Old.School is offline
Old 04-23-2018, 18:16
Old.School
This message has been deleted by Old.School.
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2018 , 18:43   Re: [REQ] Detect no kill and punish ( Players which is not killing the enemies)
Reply With Quote #40

Quote:
Originally Posted by Old.School View Post
-false detect when player when round end with c4 for example and the player was looking /shooting the enemy than auto punish at round start...
For this I will reset counter at round end.

Quote:
Originally Posted by Old.School View Post
-false detect when shooting by only one shoot every one/two seconds cause of distance means when the player crosshair go up of the enemy cause of distance..
Not sure how to fix this since I do not run or server or experience what this plugin is for. You give the idea and I code it.
__________________
Bugsy 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:59.


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