|
发表于 2009-10-26 12:56:59
|
显示全部楼层
来自 中国–广东–肇庆
本帖最后由 zwfgdlc 于 2009-11-11 18:39 编辑
理论上应该是没问题了,默认限制自杀次数为5,大于则踢出服务器.
另外禁用了快速切换刀,因为与自动给USP加消声器有冲突,是hamsandwich模块的问题
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <hamsandwich>
- #include <fakemeta>
- #define PLUGIN_NAME "New Plug-In"
- #define PLUGIN_VERSION "1.0"
- #define PLUGIN_AUTHOR "zwfgdlc"
- new SuicidecCount[33];
- new pcvar_SuicedecLimit;
- public plugin_init()
- {
- register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
- RegisterHam(Ham_Spawn,"weaponbox","fwd_WboxSpawn",1);
- RegisterHam(Ham_Item_Deploy,"weapon_usp","fwd_Item_Deploy");
- RegisterHam(Ham_Item_Deploy,"weapon_glock18","fwd_Item_Deploy");
- RegisterHam(Ham_Killed,"player","fwd_PlayerKilled");
- RegisterHam(Ham_Item_CanHolster,"weapon_knife","fwd_Item_CanHolster");
- pcvar_SuicedecLimit = register_cvar("amx_SuicedecLimit","5"); //自杀次数限制,默认为5
- }
- public fwd_WboxSpawn(ent)
- {
- set_pev(ent,pev_flags,pev(ent,pev_flags)|FL_KILLME);
- dllfunc(DLLFunc_Think,ent);
- }
- public fwd_Item_Deploy(ent)
- {
- if(!cs_get_weapon_silen(ent))
- cs_set_weapon_silen(ent);
- }
- public fwd_PlayerKilled(victim, killer, shouldgib)
- {
- if(victim == killer)
- SuicidecCount[victim]++;
-
- if(SuicidecCount[victim] > get_pcvar_num(pcvar_SuicedecLimit))
- server_cmd("kick #%d ^"%s^"",get_user_userid(victim),"因你自杀次数达到上限,已被服务器踢出");
-
- return HAM_IGNORED;
- }
- public fwd_Item_CanHolster(ent)
- {
- return HAM_SUPERCEDE;
- }
- public client_putinserver(id)
- {
- SuicidecCount[id]=0;
- }
复制代码 |
|