AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Remove C4 (https://forums.alliedmods.net/showthread.php?t=74436)

Exolent[jNr] 01-20-2012 11:18

Re: Remove C4
 
Quote:

Originally Posted by ConnorMcLeod (Post 1635341)
OMG don't hook CmdStart for this lol !!!

Yo, that code is 4 years old. Give me a break, lol.

kramesa 01-20-2012 11:24

Re: Remove C4
 
What is the best? Connor, can you add a cvar for enable/disable?

Exolent[jNr] 01-20-2012 13:18

Re: Remove C4
 
Here is Connor's method with my commands:
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
// #include <cstrike>

#define VERSION "0.0.1"
#define PLUGIN ""

const XO_WEAPON 4

const m_pPlayer 41
const m_flNextPrimaryAttack 46

new bool:g_bCanPlantC4
new HamHook:g_hhC4PrimaryAttack

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
g_hhC4PrimaryAttack RegisterHam(Ham_Weapon_PrimaryAttack"weapon_c4""CC4_PrimaryAttack")
    
    
register_concmd("c4_enable""CmdEnable"ADMIN_RCON"Allows C4 to be planted");
    
register_concmd("c4_disable""CmdDisable"ADMIN_RCON"Stops C4 from being planted");
}

public 
CC4_PrimaryAttackiC4 )
{
    new 
id get_pdata_cbase(iC4m_pPlayerXO_WEAPON)
    
client_print(idprint_chat"C4 is actually disabled !!")
    
set_pdata_float(iC4m_flNextPrimaryAttack1.0XO_WEAPON)
    return 
HAM_SUPERCEDE
}

public 
CmdEnable(idlevelcid)
{
    if(
cmd_access(idlevelcid1))
    {
        
setEnabled(idtrue);
    }
    return 
PLUGIN_HANDLED;
}

public 
CmdDisable(idlevelcid)
{
    if(
cmd_access(idlevelcid1))
    {
        
setEnabled(idfalse);
    }
    return 
PLUGIN_HANDLED;
}

setEnabled(idbool:enabled)
{
    if(
enabled == g_bCanPlantC4)
    {
        
console_print(id"C4 is already %sabled."enabled "en" "dis");
    }
    else
    {
        
g_bCanPlantC4 enabled;
        
        if(
enabledEnableHamForward(g_hhC4PrimaryAttack)
        else        
DisableHamForward(g_hhC4PrimaryAttack)
        
        
console_print(id"C4 is now %sabled."enabled "en" "dis");
    }



briancmccoy 04-20-2013 03:17

Re: Remove C4
 
Include this line #include <amxmisc> in source code else compiling gives error

/tmp/textaKu2rM.sma(36) : error 017: undefined symbol "cmd_access" /tmp/textaKu2rM.sma(45) : error 017: undefined symbol "cmd_access" 2 Errors. Could not locate output file /home/groups/amxmodx/public_html/websc3/textaKu2rM.amx (compile failed).


All times are GMT -4. The time now is 00:43.

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