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

[REQ] Admin Can Make C4 Unusable


Post New Thread Reply   
 
Thread Tools Display Modes
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-11-2015 , 09:13   Re: [REQ] Admin Can Make C4 Unusable
Reply With Quote #11

Is it possible, that we use Ham_Item_Deploy for this request?

Then, check if the item is C4. If yes, set a bool. Next, make another check in FM_CmdStart. If the player is holding a C4 (when the bool is true) and he is trying to plant the bomb (when pressing IN_ATTACK button), we just return PLUGIN_HANDLED.

Is this ways or method possible and worth doing?

Last edited by zmd94; 07-11-2015 at 09:13.
zmd94 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-11-2015 , 09:49   Re: [REQ] Admin Can Make C4 Unusable
Reply With Quote #12

Quote:
Originally Posted by zmd94 View Post
Is it possible, that we use Ham_Item_Deploy for this request?

Then, check if the item is C4. If yes, set a bool. Next, make another check in FM_CmdStart. If the player is holding a C4 (when the bool is true) and he is trying to plant the bomb (when pressing IN_ATTACK button), we just return PLUGIN_HANDLED.

Is this ways or method possible and worth doing?
FM_CmdStart needs too much resources, you can do this trick: Hook Ham_Weapon_WeaponIdle but disabled the hook, when Ham_Item_Deploy enable it and disable it again on Ham_Item_Holster(he switched the weapon, checking is no longer needed now). Btw, you should return FMRES_SUPERCEDE in a fakemeta forward. Also, no need to set anything in ItemDeploy, it is enough to check inside WeaponIndle get_user_weapon and see if it is equal to CSW_C4.

Your way just block the c4 from being planted, mine completly remove the bomb.
__________________

Last edited by HamletEagle; 07-11-2015 at 09:50.
HamletEagle is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-11-2015 , 10:01   Re: [REQ] Admin Can Make C4 Unusable
Reply With Quote #13

Alright, I got it. I have learned something today. I appreciate your explanation. ;)

Last edited by zmd94; 07-11-2015 at 10:02.
zmd94 is offline
alibalali
Member
Join Date: Aug 2014
Old 07-11-2015 , 14:03   Re: [REQ] Admin Can Make C4 Unusable
Reply With Quote #14

Quote:
Originally Posted by HamletEagle View Post
Try this(hope I understood what you want). You will need orpheu module for it.

In addons/amxmodx/configs/orpheu/virtualFunctions create a folder called CGameRules and inside a file called GiveC4. Copy inside it:

Code:
{
    "name" : "GiveC4",
    "class" : "CGameRules",
    "library" : "mod",
    "indexes" : 
    [
        {
            "os" : "windows",
            "mod" : "cstrike",
            "value" : 67
        },
        {
            "os" : "linux",
            "mod" : "cstrike",
            "value" : 69
        }
    ]
}
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <orpheu>
#include <engine>
#include <fakemeta>
#include <cstrike>

#define PluginName    "Remove the bomb"
#define PluginVersion "0.1"
#define PluginAuthor  "HamletEagle"

new pGameRulesObject
new gmsgStatusIcon
new gmsgScoreAttrib

new OrpheuFunction:HandleGiveC4Func
new bool:PluginEnabled

public plugin_precache()
{
    new 
OrpheuFunction:HandleInstallGameRulesFunc OrpheuGetFunction("InstallGameRules")
    
OrpheuRegisterHook(HandleInstallGameRulesFunc"OnInstallGameRules"OrpheuHookPost)
}
public 
OnInstallGameRules()
{
    
pGameRulesObject OrpheuGetReturn() 
}  

public 
plugin_init()
{
    
register_plugin
    
(
        .
plugin_name PluginName,
        .
version     PluginVersion,
        .
author         PluginAuthor
    
)
    
    
gmsgStatusIcon get_user_msgid("StatusIcon"
    
gmsgScoreAttrib get_user_msgid"ScoreAttrib" )
    
    
register_concmd("amx_removebomb""ClientCommand_RemoveBomb"ADMIN_KICK)
    
    
HandleGiveC4Func OrpheuGetFunctionFromObject(pGameRulesObject"GiveC4""CGameRules")
    
OrpheuRegisterHook(HandleGiveC4Func"OnGiveC4"OrpheuHookPre)
}

public 
ClientCommand_RemoveBomb(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
    {
        return 
1
    
}
    
    new const 
Message[][] = {"enabled""disabled"
    
    
PluginEnabled = !PluginEnabled
    client_print
(idprint_chat"You have %s the bomb"Message[PluginEnabled])
    
    if(
PluginEnabled)
    {
        new 
C4Entity find_ent_by_class(-1"weapon_c4")
        if(
pev_valid(C4Entity))
        {
            new 
Owner pev(C4Entitypev_owner)
            
            
engclient_cmd(Owner"weapon_c4")
            
cs_set_user_bpammo(OwnerCSW_C40)
            
engclient_cmd(Owner"lastinv")
            
            
message_begin(MSG_ONE_UNRELIABLEgmsgStatusIcon_id)
            {
                
write_byte(0)
                
write_string("c4")
                
message_end()
            }
            
            
message_begin(MSG_ONE_UNRELIABLEgmsgScoreAttrib_id)
            {
                
write_byte(Owner)
                
write_byte(0)
                
message_end()
            }
        }
    }
    return 
1
}

public 
OrpheuHookReturn:OnGiveC4(GameRulesObject)
{
    if(
PluginEnabled)
    {
        return 
OrpheuSupercede
    
}
    
    return 
OrpheuIgnored

The command is amx_removebomb, default admin access is ADMIN_KICK. Write the command one time to block the bomb, write it again to re-enable it(the bomb won't be given instantly, but only on new round - if you want the bomb to be given to a player when you enable it tell me).
WOW this is that I want
worked fine.
thanks so much
but small bug
if no one carry bomb and bomb be on the ground using cvar makes a small problem, plugin not works until next round and an error be shown
PHP Code:
amx_removebomb 
L 07
/11/2015 22:29:56Invalid player id 120
L 07
/11/2015 22:29:56: [AMXXRun time error 10 (plugin "amx_removebomb.amxx") (native "engclient_cmd") - debug not enabled!
L 07/11/2015 22:29:56: [AMXXTo enable debug modeadd "debug" after the plugin name in plugins.ini (without quote
If you can add the option for giving back the c4 it will be perfect.
special thanks
__________________
Going to be Banned
alibalali is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-11-2015 , 14:11   Re: [REQ] Admin Can Make C4 Unusable
Reply With Quote #15

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <orpheu>
#include <engine>
#include <fakemeta>
#include <cstrike>

#define PluginName    "Remove the bomb"
#define PluginVersion "0.2"
#define PluginAuthor  "HamletEagle"

new pGameRulesObject
new gmsgStatusIcon
new gmsgScoreAttrib
new gmsgBombPickup
new MaxPlayers

new OrpheuFunction:HandleGiveC4Func
new bool:PluginEnabled

public plugin_precache()
{
    new 
OrpheuFunction:HandleInstallGameRulesFunc OrpheuGetFunction("InstallGameRules")
    
OrpheuRegisterHook(HandleInstallGameRulesFunc"OnInstallGameRules"OrpheuHookPost)
}
public 
OnInstallGameRules()
{
    
pGameRulesObject OrpheuGetReturn() 
}  

public 
plugin_init()
{
    
register_plugin
    
(
        .
plugin_name PluginName,
        .
version     PluginVersion,
        .
author         PluginAuthor
    
)
    
    
MaxPlayers get_maxplayers()

    
gmsgStatusIcon  get_user_msgid("StatusIcon"
    
gmsgScoreAttrib get_user_msgid"ScoreAttrib" )
    
gmsgBombPickup  get_user_msgid("BombPickup")
    
register_concmd("amx_removebomb""ClientCommand_RemoveBomb"ADMIN_KICK)

    
HandleGiveC4Func OrpheuGetFunctionFromObject(pGameRulesObject"GiveC4""CGameRules")
    
OrpheuRegisterHook(HandleGiveC4Func"OnGiveC4"OrpheuHookPre)
}

public 
ClientCommand_RemoveBomb(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
    {
        return 
1
    
}

    new const 
Message[][] = {"enabled""disabled"

    
PluginEnabled = !PluginEnabled
    client_print
(idprint_chat"You have %s the bomb"Message[PluginEnabled])

    if(
PluginEnabled)
    {
        new 
C4Entity find_ent_by_class(-1"weapon_c4")
        if(
pev_valid(C4Entity))
        {
            new 
Owner pev(C4Entitypev_owner)
            
            if(
<= Owner <= MaxPlayers)
            {
                
engclient_cmd(Owner"weapon_c4")
                
cs_set_user_bpammo(OwnerCSW_C40)
                
engclient_cmd(Owner"lastinv")
                
                
message_begin(MSG_ONE_UNRELIABLEgmsgStatusIcon_id)
                {
                    
write_byte(0)
                    
write_string("c4")
                    
message_end()
                }
                
                
message_begin(MSG_ONE_UNRELIABLEgmsgScoreAttrib_id)
                {
                    
write_byte(Owner)
                    
write_byte(0)
                    
message_end()
                }
            }
            else
            {
                if(
pev_valid(Owner))
                {
                    
dllfunc(DLLFunc_ThinkOwner
                    
message_begin(MSG_ALLgmsgBombPickup)
                    {
                        
message_end()
                    }
                }
            }
        }
    }
    else
    {
        
OrpheuCall(HandleGiveC4FuncpGameRulesObject)
    }
    return 
1
}

public 
OrpheuHookReturn:OnGiveC4(GameRulesObject)
{
    if(
PluginEnabled)
    {
        return 
OrpheuSupercede
    
}

    return 
OrpheuIgnored

Did not tested this time, but it should work. If the error appears again please write the error log after you add debug after plugin name in plugins.init
__________________

Last edited by HamletEagle; 07-11-2015 at 14:44.
HamletEagle is offline
alibalali
Member
Join Date: Aug 2014
Old 07-12-2015 , 05:33   Re: [REQ] Admin Can Make C4 Unusable
Reply With Quote #16

Quote:
Originally Posted by HamletEagle View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <orpheu>
#include <engine>
#include <fakemeta>
#include <cstrike>

#define PluginName    "Remove the bomb"
#define PluginVersion "0.2"
#define PluginAuthor  "HamletEagle"

new pGameRulesObject
new gmsgStatusIcon
new gmsgScoreAttrib
new gmsgBombPickup
new MaxPlayers

new OrpheuFunction:HandleGiveC4Func
new bool:PluginEnabled

public plugin_precache()
{
    new 
OrpheuFunction:HandleInstallGameRulesFunc OrpheuGetFunction("InstallGameRules")
    
OrpheuRegisterHook(HandleInstallGameRulesFunc"OnInstallGameRules"OrpheuHookPost)
}
public 
OnInstallGameRules()
{
    
pGameRulesObject OrpheuGetReturn() 
}  

public 
plugin_init()
{
    
register_plugin
    
(
        .
plugin_name PluginName,
        .
version     PluginVersion,
        .
author         PluginAuthor
    
)
    
    
MaxPlayers get_maxplayers()

    
gmsgStatusIcon  get_user_msgid("StatusIcon"
    
gmsgScoreAttrib get_user_msgid"ScoreAttrib" )
    
gmsgBombPickup  get_user_msgid("BombPickup")
    
register_concmd("amx_removebomb""ClientCommand_RemoveBomb"ADMIN_KICK)

    
HandleGiveC4Func OrpheuGetFunctionFromObject(pGameRulesObject"GiveC4""CGameRules")
    
OrpheuRegisterHook(HandleGiveC4Func"OnGiveC4"OrpheuHookPre)
}

public 
ClientCommand_RemoveBomb(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
    {
        return 
1
    
}

    new const 
Message[][] = {"enabled""disabled"

    
PluginEnabled = !PluginEnabled
    client_print
(idprint_chat"You have %s the bomb"Message[PluginEnabled])

    if(
PluginEnabled)
    {
        new 
C4Entity find_ent_by_class(-1"weapon_c4")
        if(
pev_valid(C4Entity))
        {
            new 
Owner pev(C4Entitypev_owner)
            
            if(
<= Owner <= MaxPlayers)
            {
                
engclient_cmd(Owner"weapon_c4")
                
cs_set_user_bpammo(OwnerCSW_C40)
                
engclient_cmd(Owner"lastinv")
                
                
message_begin(MSG_ONE_UNRELIABLEgmsgStatusIcon_id)
                {
                    
write_byte(0)
                    
write_string("c4")
                    
message_end()
                }
                
                
message_begin(MSG_ONE_UNRELIABLEgmsgScoreAttrib_id)
                {
                    
write_byte(Owner)
                    
write_byte(0)
                    
message_end()
                }
            }
            else
            {
                if(
pev_valid(Owner))
                {
                    
dllfunc(DLLFunc_ThinkOwner
                    
message_begin(MSG_ALLgmsgBombPickup)
                    {
                        
message_end()
                    }
                }
            }
        }
    }
    else
    {
        
OrpheuCall(HandleGiveC4FuncpGameRulesObject)
    }
    return 
1
}

public 
OrpheuHookReturn:OnGiveC4(GameRulesObject)
{
    if(
PluginEnabled)
    {
        return 
OrpheuSupercede
    
}

    return 
OrpheuIgnored

Did not tested this time, but it should work. If the error appears again please write the error log after you add debug after plugin name in plugins.init
It's Perfect without any bugs
This plugin helped me to use de maps as fy maps
thanks a lot
__________________
Going to be Banned
alibalali is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-12-2015 , 05:38   Re: [REQ] Admin Can Make C4 Unusable
Reply With Quote #17

Is the dropped c4 removed ? I had some problems while testing, even if the method of removing it is correct the c4 refused to dissapear. Please confirm this.

Anyway, I'm glad that I helped you
__________________

Last edited by HamletEagle; 07-12-2015 at 05:42.
HamletEagle is offline
alibalali
Member
Join Date: Aug 2014
Old 07-12-2015 , 07:57   Re: [REQ] Admin Can Make C4 Unusable
Reply With Quote #18

Quote:
Originally Posted by HamletEagle View Post
Is the dropped c4 removed ? I had some problems while testing, even if the method of removing it is correct the c4 refused to dissapear. Please confirm this.

Anyway, I'm glad that I helped you
If the bomb be on the ground by using cvar bomb will hide from ground without any problem
if some one carry bomb player will be disarm from c4 but I don't know c4 will be hide from player back or not
thanks a lot
__________________
Going to be Banned

Last edited by alibalali; 07-12-2015 at 07:59.
alibalali is offline
Reply


Thread Tools
Display Modes

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 19:33.


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