【穿人卡源码】
自己修改的,有什么不对的地方请指出来,谢谢大家!#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <unlimited_money>
#define DISTANCE 120
new bool:g_bSolid
new Float:g_fOrigin
new bool:g_bHasSemiclip
new bool:g_MsgOn
new g_iMaxPlayers
new HasBuy,g_money;
new count
public plugin_init( )
{
register_plugin( "Antiblock", "1.1", "Maslyak&David Peng" )
register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" )
register_forward( FM_PlayerPostThink, "fwdPlayerPostThink" )
register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 )
register_event("HLTV", "EventNewRound", "a", "1=0", "2=0");
register_clcmd("buy_ab", "buy_antiblock")
g_iMaxPlayers = get_maxplayers( )
}
public EventNewRound()
{
new member=0
for(new id=1; id<=g_iMaxPlayers; id++)
{
if(HasBuy==1)
{
member++
HasBuy=0;
}
if (!is_user_alive(id)||!(get_user_flags(id)&ADMIN_LEVEL_F))
{
HasBuy=0;
}
count=0;
}
}
public client_connect(id)
{
HasBuy = 0;
}
public fwdPlayerPreThink( plr )
{
static id, last_think
new P_name,D_name
new dpport
get_user_name(plr, D_name, 32);
if( last_think > plr )
{
for( id = 1; id <= g_iMaxPlayers; id++ )
{
if( is_user_alive( id )&&HasBuy==1 )
{
g_bSolid = pev( id, pev_solid ) == SOLID_SLIDEBOX ? true : false
pev( id, pev_origin, g_fOrigin )
}
else
g_bSolid = false
}
}
last_think = plr
if( g_bSolid )
{
for( id = 1; id <= g_iMaxPlayers; id++ )
{
new victim
if( g_bSolid && get_distance_f( g_fOrigin, g_fOrigin ) <= DISTANCE && id != plr&&get_user_team(id) == get_user_team(plr) )
{
if(!(pev(plr, pev_button) & IN_USE))
return FMRES_IGNORED
set_pev( id, pev_solid, SOLID_NOT )
g_bHasSemiclip = true
g_MsgOn = true
count++
victim=id;
get_user_name(victim, P_name, 32);
}
}
if(g_MsgOn&&count==1)
{
format(dpport,222,"^x01【^x04提示^x01】^x03%s^01使用^x03【^x04穿人卡^x03】^x01穿过了他前面的^x03%s^x01!",D_name,P_name)
client_color(0, plr, dpport)
}
}
return FMRES_IGNORED
}
public fwdPlayerPostThink( plr )
{
static id
for( id = 1; id <= g_iMaxPlayers; id++ )
{
if(g_bHasSemiclip)
{
set_pev( id, pev_solid, SOLID_SLIDEBOX )
g_bHasSemiclip = false
}
}
if(g_MsgOn)
{
g_MsgOn = false
}
if(!(pev(plr, pev_button) & IN_USE))
{
count=0;
}
}
public fwdAddToFullPack_Post( es_handle, e, ent, host, hostflags, player, pset )
{
if( player&&HasBuy==1)
{
if( g_bSolid && g_bSolid && get_distance_f( g_fOrigin, g_fOrigin ) <= DISTANCE )
{
if(get_user_team(host) != get_user_team(ent))
return FMRES_IGNORED
if(!(pev(host, pev_button) & IN_USE))
return FMRES_IGNORED
set_es( es_handle, ES_Solid, SOLID_NOT ) // makes semiclip flawless
set_es( es_handle, ES_RenderMode, kRenderTransAlpha )
set_es( es_handle, ES_RenderAmt, 85 )
}
}
return FMRES_IGNORED
}
public buy_antiblock(id)
{
new dpport,D_name;
get_user_name(id, D_name, 31);
g_money = cs_get_user_money2(id);
if(HasBuy==1)
{
format(dpport,222,"^x03您已经获得了该道具!")
client_color(id,id,dpport)
return PLUGIN_HANDLED;
}
if(!is_user_alive(id)) return PLUGIN_HANDLED;
if(!is_user_connected(id)) return PLUGIN_HANDLED;
if(g_money>=300)
{
cs_set_user_money2(id, g_money - 300)
HasBuy=1;
format(dpport,222,"^x01【^x04提示^x01】^x03%s^01购买了^x03【^x04穿人卡^x03】^x01,现在他可以自由穿梭了!",D_name)
client_color(0, id, dpport)
}
else if(g_money<300||HasBuy==0)
{
format(dpport,222,"^x01你没有足够的资金购买^x03【^x04穿人卡^x03】^x01!")
client_color(id, id, dpport)
}
return PLUGIN_CONTINUE;
}
public client_color(playerid,colorid,msg[])
{
message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, playerid)
write_byte(colorid)
write_string(msg)
message_end()
}
// is there a better way to detect changings of g_iCvar?
如果需要其他源码的 请联系QQ 448283676 不错不错不错 xing9634 发表于 2016-4-1 16:49
如果需要其他源码的 请联系QQ 448283676
权限:ADMIN_LEVEL_F 输入:buy_ab 够买?按E穿人,还是自动穿人?
页:
[1]