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

Gun Planting Prevention


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 10-18-2012 , 21:33   Gun Planting Prevention
Reply With Quote #1

Here are some ideas for a new feature in the next SM_Hosties to prevent gun planting or mitigate its effects. Would like to hear feedback from the community on this before it's made.

__________________
databomb is offline
poppin-fresh
AlliedModders Donor
Join Date: Aug 2010
Old 10-23-2012 , 22:35   Re: Gun Planting Prevention
Reply With Quote #2

This is a really good idea, I would love to see it implemented, especially the safety timer.
poppin-fresh is offline
Swoldier
Junior Member
Join Date: Apr 2013
Old 04-07-2013 , 11:13   Re: Gun Planting Prevention
Reply With Quote #3

love this idea. would love to see it as well
Swoldier is offline
exactprecisions
Member
Join Date: Apr 2013
Old 04-23-2013 , 01:06   Re: Gun Planting Prevention
Reply With Quote #4

Quote:
Originally Posted by databomb View Post
Here are some ideas for a new feature in the next SM_Hosties to prevent gun planting or mitigate its effects. Would like to hear feedback from the community on this before it's made.

I actually have a question that is off-topic, is the trunk release of your sm_hosties always the most "update version"
exactprecisions is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 06-08-2013 , 10:23   Re: Gun Planting Prevention
Reply With Quote #5

Untested and can't test atm. Give me news.
0 = slay, 1 = remove weapon, 2 = both.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

new Handle:g_cvHostieGunplantPreventionTimer;
new 
Handle:g_cvHostieGunplantPunish;

public 
OnPluginStart()
{
    
g_cvHostieGunplantPreventionTimer CreateConVar("hostie_gunplant_prevention_time""1.337""Time to prevent a gun plant when a weapon is drop."FCVAR_NOTIFY|FCVAR_DEMO|FCVAR_PLUGINtrue0.1false);
    
g_cvHostieGunplantPunish CreateConVar("hostie_gunplant_punish""1""0 = slay, 1 = remove weapon, 2 = both."FCVAR_NOTIFY|FCVAR_DEMO|FCVAR_PLUGINtrue0.0true2.0);
}

public 
Action:CS_OnCSWeaponDrop(clientweapon)
{
    if (
IsClientInGame(client) && GetClientTeam(client) == CS_TEAM_CT)
    {
        new 
Handle:data CreateDataPack();
        
WritePackCell(dataclient);
        
WritePackCell(dataweapon);
        
        
CreateTimer(GetConVarFloat(g_cvHostieGunplantPreventionTimer), GunPlantPreventionTimerdata);
    }
}

public 
Action:GunPlantPreventionTimer(Handle:timerany:data)
{
    
ResetPack(data);
    new 
original_owner ReadPackCell(data);
    new 
weapon ReadPackCell(data);
    
    new 
new_owner GetEntPropEnt(weaponProp_Data"m_hOwnerEntity");  
    if (
IsValidEdict(weapon) && IsClientInGame(original_owner) && IsPlayerAlive(original_owner) && IsClientInGame(new_owner) && GetClientTeam(new_owner) != GetClientTeam(original_owner))
    {
        
// GUN PLANT! PANIC!
        
switch (GetConVarInt(g_cvHostieGunplantPunish))
        {
            case (
0):
            {
                
ForcePlayerSuicide(original_owner);
            }
            case (
1):
            {
                
AcceptEntityInput(weapon"kill");
            }
            case (
2):
            {
                
AcceptEntityInput(weapon"kill");
                
ForcePlayerSuicide(original_owner);
            }
        }
    }


Last edited by Mathias.; 06-08-2013 at 10:28.
Mathias. is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 06-10-2013 , 23:55   Re: Gun Planting Prevention
Reply With Quote #6

Great work with this Black-Rabbit -- maybe I was over-complicating things a bit, especially with the first conditional on the flow chart. Remember that without the SDKHook any action taken with the gun before the safety timer fires is free game. In this case, 1.337 seconds is just the right amount of time so the prisoner cannot do much and it would catch quite a few obvious gunplants.

Quote:
Originally Posted by Black-Rabbit View Post
Untested and can't test atm. Give me news.
0 = slay, 1 = remove weapon, 2 = both.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

new Handle:g_cvHostieGunplantPreventionTimer;
new 
Handle:g_cvHostieGunplantPunish;

public 
OnPluginStart()
{
    
g_cvHostieGunplantPreventionTimer CreateConVar("hostie_gunplant_prevention_time""1.337""Time to prevent a gun plant when a weapon is drop."FCVAR_NOTIFY|FCVAR_DEMO|FCVAR_PLUGINtrue0.1false);
    
g_cvHostieGunplantPunish CreateConVar("hostie_gunplant_punish""1""0 = slay, 1 = remove weapon, 2 = both."FCVAR_NOTIFY|FCVAR_DEMO|FCVAR_PLUGINtrue0.0true2.0);
}

public 
Action:CS_OnCSWeaponDrop(clientweapon)
{
    if (
IsClientInGame(client) && GetClientTeam(client) == CS_TEAM_CT)
    {
        new 
Handle:data CreateDataPack();
        
WritePackCell(dataclient);
        
WritePackCell(dataweapon);
        
        
CreateTimer(GetConVarFloat(g_cvHostieGunplantPreventionTimer), GunPlantPreventionTimerdata);
    }
}

public 
Action:GunPlantPreventionTimer(Handle:timerany:data)
{
    
ResetPack(data);
    new 
original_owner ReadPackCell(data);
    new 
weapon ReadPackCell(data);
    
    new 
new_owner GetEntPropEnt(weaponProp_Data"m_hOwnerEntity");  
    if (
IsValidEdict(weapon) && IsClientInGame(original_owner) && IsPlayerAlive(original_owner) && IsClientInGame(new_owner) && GetClientTeam(new_owner) != GetClientTeam(original_owner))
    {
        
// GUN PLANT! PANIC!
        
switch (GetConVarInt(g_cvHostieGunplantPunish))
        {
            case (
0):
            {
                
ForcePlayerSuicide(original_owner);
            }
            case (
1):
            {
                
AcceptEntityInput(weapon"kill");
            }
            case (
2):
            {
                
AcceptEntityInput(weapon"kill");
                
ForcePlayerSuicide(original_owner);
            }
        }
    }

__________________
databomb is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 02-05-2015 , 19:12   Re: Gun Planting Prevention
Reply With Quote #7

Quote:
Originally Posted by Black-Rabbit View Post
Untested and can't test atm. Give me news.
0 = slay, 1 = remove weapon, 2 = both.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

new Handle:g_cvHostieGunplantPreventionTimer;
new 
Handle:g_cvHostieGunplantPunish;

public 
OnPluginStart()
{
    
g_cvHostieGunplantPreventionTimer CreateConVar("hostie_gunplant_prevention_time""1.337""Time to prevent a gun plant when a weapon is drop."FCVAR_NOTIFY|FCVAR_DEMO|FCVAR_PLUGINtrue0.1false);
    
g_cvHostieGunplantPunish CreateConVar("hostie_gunplant_punish""1""0 = slay, 1 = remove weapon, 2 = both."FCVAR_NOTIFY|FCVAR_DEMO|FCVAR_PLUGINtrue0.0true2.0);
}

public 
Action:CS_OnCSWeaponDrop(clientweapon)
{
    if (
IsClientInGame(client) && GetClientTeam(client) == CS_TEAM_CT)
    {
        new 
Handle:data CreateDataPack();
        
WritePackCell(dataclient);
        
WritePackCell(dataweapon);
        
        
CreateTimer(GetConVarFloat(g_cvHostieGunplantPreventionTimer), GunPlantPreventionTimerdata);
    }
}

public 
Action:GunPlantPreventionTimer(Handle:timerany:data)
{
    
ResetPack(data);
    new 
original_owner ReadPackCell(data);
    new 
weapon ReadPackCell(data);
    
    new 
new_owner GetEntPropEnt(weaponProp_Data"m_hOwnerEntity");  
    if (
IsValidEdict(weapon) && IsClientInGame(original_owner) && IsPlayerAlive(original_owner) && IsClientInGame(new_owner) && GetClientTeam(new_owner) != GetClientTeam(original_owner))
    {
        
// GUN PLANT! PANIC!
        
switch (GetConVarInt(g_cvHostieGunplantPunish))
        {
            case (
0):
            {
                
ForcePlayerSuicide(original_owner);
            }
            case (
1):
            {
                
AcceptEntityInput(weapon"kill");
            }
            case (
2):
            {
                
AcceptEntityInput(weapon"kill");
                
ForcePlayerSuicide(original_owner);
            }
        }
    }

how to fix this error in log
Code:
L 01/18/2015 - 10:53:13: [SM] Native "IsClientInGame" reported: Client index -1 is invalid
L 01/18/2015 - 10:53:13: [SM] Displaying call stack trace for plugin "disabled/hosties/gunplant.smx":
L 01/18/2015 - 10:53:13: [SM]   [0]  Line 33, C:\Users\8guawong\Downloads\sourcemod-1.6.1-windows\gunplant.sp::GunPlantPreventionTimer()

Last edited by 8guawong; 02-05-2015 at 19:13.
8guawong 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 08:25.


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