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

[REQ] Loot AFK C4 ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 07-28-2015 , 21:20   [REQ] Loot AFK C4 ?
Reply With Quote #1

Just for the heck of it ;)

Yeah, I know, I know... redundant. I'm not really into CS 1.6 lately (almost 2 years "pause" and probably counting "ad infinitum"... ) but I guess it doesn't hurt to share an idea which came from total boredom. I don't know if it was already made in this manner, but here goes:

1. If the TE Player carrying the C4 goes AFK more than "X" seconds > Player's C4 can be looted.
2. The looting it's done by aiming at the AFK Player and holding the "Use" Key near him.
3. The looting will be "signaled" with a progress bar for both Players and a Menu just for the looted.
4. Menu: 1 - Give the C4 (instantly transfers the C4) 2 - Keep the C4 (cancel the looting process)

Cvars:

loot_active - 0/1 Plugin disabled/enabled
loot_afk - How many seconds the Player needs to be AFK in order for others to be able to loot him.
loot_time - The looting process duration in seconds. 0 = Instant looting / no Progress Bar or Menu.
__________________
Originally Posted by Hawk552
Actually, if your style pisses me off enough, I'll generally go through your code and find some reason to unapprove it or at least hold it back.
Costin83 is offline
Send a message via Yahoo to Costin83
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-29-2015 , 03:46   Re: [REQ] Loot AFK C4 ?
Reply With Quote #2

Well, not exactly, but: https://forums.alliedmods.net/showthread.php?p=2316016 or a bomb afk manager: https://forums.alliedmods.net/showthread.php?t=247228

If this doesn't fulfill your request, I may do what you want, just tell me.

Ro: Poti sa incerci pluginurile alea 2, daca nu sunt ce vrei lasa reply. O sa fac exact cum ai cerut.
__________________

Last edited by HamletEagle; 07-29-2015 at 03:47.
HamletEagle is offline
Mordekay
Squirrel of Fortune
Join Date: Apr 2006
Location: Germany
Old 07-29-2015 , 04:05   Re: [REQ] Loot AFK C4 ?
Reply With Quote #3

And i can already see players abusing it, staying "afk" and waiting for someone who want to loot the bomb. Aborting it all the time and having fun with it.
I know, it would be lame and boring, but there are allways some a**holes around trying to disturb playing.
__________________

Mordekay is offline
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 07-29-2015 , 08:17   Re: [REQ] Loot AFK C4 ?
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
Well, not exactly, but: https://forums.alliedmods.net/showthread.php?p=2316016 or a bomb afk manager: https://forums.alliedmods.net/showthread.php?t=247228

If this doesn't fulfill your request, I may do what you want, just tell me.

Ro: Poti sa incerci pluginurile alea 2, daca nu sunt ce vrei lasa reply. O sa fac exact cum ai cerut.
Yeah, the first one it's more simple, thus more "close" to what I've had in mind. The 2nsd one it's kinda more complex. Anyways it is just an idea not really a request so no need to bother. But if you're dieing of boredom like me and have nothing else useful to do, then you can consider doing the plugin :p


I've also forgot a cvar:

loot_radius - How close in units one must be to the AFK Player to proceed with the looting.

and another idea:
After "X" more seconds the AFK Player drops the C4 automatically. 3 more cvars here


loot_autodropc4 - enable auto-drop the C4 after "X" more seconds ? 0/1
loot_autodropbuyzoneonly - auto-drop the C4 only while inside the Buyzone ? 0/1
loot_autodroptime - Time in seconds after player becomes "lootable" when it auto-drops the C4

Quote:
Originally Posted by Mordekay View Post
And i can already see players abusing it, staying "afk" and waiting for someone who want to loot the bomb. Aborting it all the time and having fun with it.
I know, it would be lame and boring, but there are allways some a**holes around trying to disturb playing.
True, that's likely to happen... Sadly you can't get rid of toxic Players...
__________________
Originally Posted by Hawk552
Actually, if your style pisses me off enough, I'll generally go through your code and find some reason to unapprove it or at least hold it back.

Last edited by Costin83; 07-29-2015 at 08:20.
Costin83 is offline
Send a message via Yahoo to Costin83
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-29-2015 , 09:54   Re: [REQ] Loot AFK C4 ?
Reply With Quote #5

PHP Code:
/*      Copyleft 2015

    SteaC4 is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with StealC4; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/ 

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

#define PluginName    "Steal C4"
#define PluginVersion "0.3"
#define PluginAuthor  "HamletEagle"

new const NeededSound[] = "common/wpn_denyselect.wav"

new bool:CarrierIsCamping

new BombOwner
new CvarDistance
new CvarLootTime
new CvarLootAfk
new CvarAutoDropC4
new CvarAutoDropTime
new MaxPlayers
new gmsgBarTime

public plugin_init()
{
    
register_plugin
    
(
        .
plugin_name PluginName,
        .
version     PluginVersion,
        .
author      PluginAuthor
    
)
    
    
register_forward(FM_EmitSound"PfnEmitSound")
    
RegisterHam(Ham_AddPlayerItem"player""CBasePlayer_AddPlayerItem"true)
    
    
CvarLootTime     register_cvar("loot_time""3")
    
CvarLootAfk      register_cvar("loot_afk""10")
    
CvarDistance     register_cvar("loot_distance""20.0")
    
CvarAutoDropC4   register_cvar("loot_autodropc4""0")
    
CvarAutoDropTime register_cvar("loot_autodroptime""20")
    
    
MaxPlayers get_maxplayers()
    
gmsgBarTime get_user_msgid("BarTime")
    
    
set_task(1.0"CheckCarrierAfk", .flags "b")
}   

public 
CheckCarrierAfk()
{
    if(
BombOwner == 0)
    {
        return
    }
    static 
bool:SameOrigini
    
static CampSeconds
    
static Float:PlayerOrigin[3]; pev(BombOwnerpev_originPlayerOrigin)
    static 
Float:PlayerOldOrigin[3]
    
    for(
03i++)
    {
        if(
PlayerOrigin[i] == PlayerOldOrigin[i])
        {
            
SameOrigin true
            
break
        }
        else 
        {
            
SameOrigin false
            
break
        }
    }    
    
    if(
SameOrigin)
    {
        
CampSeconds CampSeconds 1
        
if(get_pcvar_num(CvarAutoDropC4) != 0)
        {
            if(
CampSeconds >= get_pcvar_num(CvarAutoDropTime))
            {
                
#if AMXX_VERSION_NUM < 183
                    
engclient_cmd(BombOwner"drop""weapon_c4")    
                
#else
                    
amxclient_cmd(BombOwner"drop""weapon_c4")
                
#endif
                
                
BombOwner 0
                CarrierIsCamping 
false
            
}
        }
        
        if(
BombOwner != && CampSeconds >= get_pcvar_num(CvarLootAfk))
        {
            
CarrierIsCamping true
        
}
    }
    else 
    {
        
CarrierIsCamping false
    
}
    
    
PlayerOldOrigin PlayerOrigin
}

public 
CBasePlayer_AddPlayerItem(idWeaponEntity)
{
    if(
pev_valid(WeaponEntity) && cs_get_weapon_id(WeaponEntity) == CSW_C4)
    {
        if(
<= id <= MaxPlayers)
        {
            
BombOwner id
        
}
    }
}

public 
PfnEmitSound(idChannel, const Sound[], Float:VolumeFloat:AttenuationFlagsPitch)
{
    if(
equal(SoundNeededSound) && (pev(idpev_button) & IN_USE)) //just to make sure, the sound may be reused for another action
    
{
        if(
<= id <= MaxPlayers)
        {
            if(!
user_has_weapon(idCSW_C4) && get_user_team(id) == 1)
            {
                if(
CarrierIsCamping)
                {
                    new 
TargetBody
                    get_user_aiming
(idTargetBody)
                    if(
<= Target <= MaxPlayers && Target == BombOwner)
                    {
                        new 
Float:TargetOrigin[3]; pev(Targetpev_originTargetOrigin)
                        new 
Float:PlayerOrigin[3]; pev(idpev_originPlayerOrigin)
                        
                        if(
get_distance_f(PlayerOriginTargetOrigin) <= get_pcvar_float(CvarDistance))
                        {
                            new 
Time get_pcvar_num(CvarLootTime)
                            
message_begin(MSG_ONEgmsgBarTime_id)
                            {
                                
write_short(Time)
                                
message_end()
                            }   
                            
set_task(float(Time), "TransferC4"id)
                        }
                    }
                }
            }
        }
    }
    
}

public 
TransferC4(id)
{
    
fm_transfer_user_gun(BombOwneridCSW_C4)
                            
    
user_has_weapon(BombOwnerCSW_C40)
    
user_has_weapon(idCSW_C41)
                            
    
BombOwner id
}

stock bool:fm_transfer_user_gun(index1index2wid 0, const wname[] = "")
{
    new 
ent_class[32]
    if(!
wid && wname[0])
    {
        
copy(ent_classcharsmax(ent_class), wname)
    }
    else 
    {
        new 
weapon widclipammo
        
if(!weapon && !(weapon get_user_weapon(index1clipammo)))
        {
            return 
false
        
}
        
        
get_weaponname(weaponent_classcharsmax(ent_class))
    }

    new 
ent_weap find_ent_by_owner(-1ent_classindex1)
    if(!
ent_weap)
    {
        return 
false
    
}

    
engclient_cmd(index1"drop"ent_class)

    new 
ent_box pev(ent_weappev_owner)
    if(!
ent_box || ent_box == index1)
    {
        return 
false
    
}

    
set_pev(ent_boxpev_flagspev(ent_boxpev_flags) | FL_ONGROUND)
    
dllfunc(DLLFunc_Touchent_boxindex2)
    if(
pev(ent_weappev_owner) != index2)
    {
        return 
false
    
}

    return 
true

Well, it was not hard, I had 80% of code already done(from two plugins that I linked above). I did not test because I don't feel like doing it with bots. If someone try it let me know if it works correctly.
__________________

Last edited by HamletEagle; 07-29-2015 at 11:44. Reason: Added BarTime and loot_time cvar.
HamletEagle is offline
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 07-29-2015 , 11:13   Re: [REQ] Loot AFK C4 ?
Reply With Quote #6

Lol, l-ai si facut Ms. Probabil ca am sa-l testez mai tarziu. Daca am sa mai am rabdare sa fac un server si sa gasesc pe cineva cu care sa-l testez :p

EDIT: Haha! I-ai pus si sunet ) Tare!
__________________
Originally Posted by Hawk552
Actually, if your style pisses me off enough, I'll generally go through your code and find some reason to unapprove it or at least hold it back.

Last edited by Costin83; 07-29-2015 at 11:16.
Costin83 is offline
Send a message via Yahoo to Costin83
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-29-2015 , 11:24   Re: [REQ] Loot AFK C4 ?
Reply With Quote #7

Sunetu ala e ca sa detectez cand apesi e, dar daca vrei ii pun sunet custom la steal Ah, am uitat sa adaug faza cu progress bar, acum se fura instant. Imediat editez

The sound is for detecting when player press e, but if you want a custom sound I can add it. But, I forgot to add the progress bar, now the stealing happen instantly. Will edit right now.

Edit: Done, BarTime added.
__________________

Last edited by HamletEagle; 07-29-2015 at 11:30.
HamletEagle is offline
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 07-29-2015 , 11:30   Re: [REQ] Loot AFK C4 ?
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
Sunetu ala e ca sa detected cand apesi e, dar daca vrei ii pun sunet custom la steal Ah, am uitat sa adaug faza cu progress bar, acum se fura instant. Imediat editez

The sound if for detecting when player press e, but if you want a custom sound I can add it. But, I forgot to add the progress bar, now the stealing happen instantly. Will edit right now.
Da, asta tocmai ma uitam acum prin script. Cautam bara de progres si nu o gaseam )
Inca ceva daca nu e deranj prea mare. afk time si auto-drop time

0 >> AFK Time
0 >> Auto-Drop Time

Asa vine acum daca inteleg bine codul. Crezi ca poti sa faci sa fie asa:

0 >> AFK Time >> Auto-Drop Time.

In felul asta poti sa eviti AFK time sa fie mai mare decat Auto-Drop Time.

Si un typo: "loot_autodromtime" >> "loot_autodroptime"
__________________
Originally Posted by Hawk552
Actually, if your style pisses me off enough, I'll generally go through your code and find some reason to unapprove it or at least hold it back.
Costin83 is offline
Send a message via Yahoo to Costin83
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-29-2015 , 11:42   Re: [REQ] Loot AFK C4 ?
Reply With Quote #9

You can put any values you want, there is no restriction. What do you mean with:
Quote:
0 >> AFK Time
0 >> Auto-Drop Time

Asa vine acum daca inteleg bine codul. Crezi ca poti sa faci sa fie asa:

0 >> AFK Time >> Auto-Drop Time.
Typo resolved.
__________________

Last edited by HamletEagle; 07-29-2015 at 11:44.
HamletEagle is offline
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 07-29-2015 , 11:53   Re: [REQ] Loot AFK C4 ?
Reply With Quote #10

Quote:
Originally Posted by HamletEagle View Post
You can put any values you want, there is no restriction. What do you mean with:


Typo resolved.
The auto-drop time it's independent from afk time, so if ex. afktime = 10 and auto-drop time = 5 the Bomb it's dropped before the player it's considered being AFK so there will be 5 seconds to AFK time left and the player won't ever be considered AFK because he already dropped the Bomb.

The auto-drop time should be starting when the player it's considered/detected as being AFK. So if for ex. afktime = 10 and auto-drop time = 5 the Bomb will be dropped 5 seconds after the player it's being considered being AFK or 15 seconds since the AFK timer starts the check.
For afktime = 10 and auto-drop time = 0 the Bomb would be dropped instantly when the player it's considered AFK but there still are the 10 seconds AFK time for others to loot the Bomb.
__________________
Originally Posted by Hawk552
Actually, if your style pisses me off enough, I'll generally go through your code and find some reason to unapprove it or at least hold it back.
Costin83 is offline
Send a message via Yahoo to Costin83
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 14:42.


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