|
Member
|
07-12-2015
, 05:33
Re: [REQ] Admin Can Make C4 Unusable
|
#16
|
Quote:
Originally Posted by HamletEagle
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(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) if(1 <= Owner <= MaxPlayers) { 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() } } else { if(pev_valid(Owner)) { dllfunc(DLLFunc_Think, Owner) message_begin(MSG_ALL, gmsgBombPickup) { message_end() } } } } } else { OrpheuCall(HandleGiveC4Func, pGameRulesObject) } 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
|
|
|
|