Member
|
07-11-2015
, 14:03
Re: [REQ] Admin Can Make C4 Unusable
|
#14
|
Quote:
Originally Posted by HamletEagle
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(id, level, cid) { if(!cmd_access(id, level, cid, 1)) { return 1 } new const Message[][] = {"enabled", "disabled"} PluginEnabled = !PluginEnabled client_print(id, print_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(C4Entity, pev_owner) engclient_cmd(Owner, "weapon_c4") cs_set_user_bpammo(Owner, CSW_C4, 0) engclient_cmd(Owner, "lastinv") message_begin(MSG_ONE_UNRELIABLE, gmsgStatusIcon, _, id) { write_byte(0) write_string("c4") message_end() } message_begin(MSG_ONE_UNRELIABLE, gmsgScoreAttrib, _, 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:56: Invalid player id 120 L 07/11/2015 - 22:29:56: [AMXX] Run time error 10 (plugin "amx_removebomb.amxx") (native "engclient_cmd") - debug not enabled! L 07/11/2015 - 22:29:56: [AMXX] To enable debug mode, add "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
|
|