View Single Post
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