|
发表于 2008-6-21 20:42:39
|
显示全部楼层
来自 中国–广东–惠州
回复: 有没有前辈能做一个限制玩家发枪的插件。一个玩家只能发5把枪。
看你发好几天,今天正好有点空,帮下你吧.
以下代码限制,在购买时间内发枪,购买时间过后不限制,否则就不合理了.看到有把好枪想捡来用都不行.
[php]
#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "droprestrict"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
new dropcount[33]={0,0,0,...};
new bool:droprestrict
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_clcmd("drop","cmddrop")
register_event("HLTV","eHLTV","a","1=0","2=0")
}
public cmddrop(id)
{
if(!droprestrict) return PLUGIN_CONTINUE;
new clip,ammo;
new wpn=get_user_weapon(id,clip,ammo)
if(wpn!=CSW_KNIFE&&wpn!=CSW_SMOKEGRENADE&&wpn!=CSW_FLASHBANG&&wpn!=CSW_HEGRENADE)
{
dropcount[id]++
if(dropcount[id]>5)
return PLUGIN_HANDLED;
}else return PLUGIN_CONTINUE;
return PLUGIN_HANDLED
}
public eHLTV()
{
droprestrict=true;
new maxplayer=get_playersnum()
for(new id=1;id<=maxplayer;id++)
{
dropcount[id]=0;
}
set_task(get_cvar_float("mp_buytime")*60.0+get_cvar_float("mp_freezetime"),"drop_switch")
}
public drop_switch()
{
droprestrict=false;
}
[/php] |
|