搜索
查看: 3453|回复: 3

[AMXX 带源码] 【穿人卡源码】

[复制链接]
发表于 2016-3-29 17:14:15 | 显示全部楼层 |阅读模式 来自 中国–湖南–长沙
自己修改的,有什么不对的地方请指出来,谢谢大家!

  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <cstrike>
  4. #include <unlimited_money>

  5. #define DISTANCE 120

  6. new bool:g_bSolid[33]
  7. new Float:g_fOrigin[33][3]
  8. new bool:g_bHasSemiclip[33]
  9. new bool:g_MsgOn[33]
  10. new g_iMaxPlayers
  11. new HasBuy[33],g_money;
  12. new count[33]

  13. public plugin_init( )
  14. {
  15.         register_plugin( "Antiblock", "1.1", "Maslyak&David Peng" )
  16.        
  17.         register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" )
  18.         register_forward( FM_PlayerPostThink, "fwdPlayerPostThink" )
  19.         register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 )
  20.         register_event("HLTV", "EventNewRound", "a", "1=0", "2=0");
  21.         register_clcmd("buy_ab", "buy_antiblock")
  22.        
  23.         g_iMaxPlayers = get_maxplayers( )
  24. }

  25. public EventNewRound()
  26. {
  27.         new member=0
  28.         for(new id=1; id<=g_iMaxPlayers; id++)
  29.          {
  30.                 if(HasBuy[id]==1)
  31.                 {
  32.                         member++
  33.                         HasBuy[member]=0;
  34.                 }
  35.                 if (!is_user_alive(id)||!(get_user_flags(id)&ADMIN_LEVEL_F))
  36.                 {
  37.                         HasBuy[id]=0;
  38.                 }
  39.                 count[id]=0;
  40.         }
  41. }

  42. public client_connect(id)
  43. {
  44.         HasBuy[id] = 0;       
  45. }

  46. public fwdPlayerPreThink( plr )
  47. {
  48.         static id, last_think
  49.         new P_name[33],D_name[33]
  50.         new dpport[222]
  51.         get_user_name(plr, D_name, 32);
  52.         if( last_think > plr )
  53.         {
  54.                 for( id = 1; id <= g_iMaxPlayers; id++ )
  55.                 {
  56.                         if( is_user_alive( id )&&HasBuy[plr]==1 )
  57.                         {
  58.                                 g_bSolid[id] = pev( id, pev_solid ) == SOLID_SLIDEBOX ? true : false
  59.                                 pev( id, pev_origin, g_fOrigin[id] )
  60.                         }
  61.                         else
  62.                                 g_bSolid[id] = false
  63.                 }
  64.         }
  65.         last_think = plr
  66.         if( g_bSolid[plr] )
  67.         {
  68.                 for( id = 1; id <= g_iMaxPlayers; id++ )
  69.                 {
  70.                         new victim
  71.                         if( g_bSolid[id] && get_distance_f( g_fOrigin[plr], g_fOrigin[id] ) <= DISTANCE && id != plr&&get_user_team(id) == get_user_team(plr) )
  72.                         {
  73.                                 if(!(pev(plr, pev_button) & IN_USE))                               
  74.                                         return FMRES_IGNORED
  75.                                 set_pev( id, pev_solid, SOLID_NOT )
  76.                                 g_bHasSemiclip[id] = true
  77.                                 g_MsgOn[plr] = true
  78.                                 count[plr]++
  79.                                 victim=id;
  80.                                 get_user_name(victim, P_name, 32);
  81.                         }
  82.                 }
  83.                 if(g_MsgOn[plr]&&count[plr]==1)
  84.                 {
  85.                         format(dpport,222,"^x01【^x04提示^x01】^x03%s^01使用^x03【^x04穿人卡^x03】^x01穿过了他前面的^x03%s^x01!",D_name,P_name)
  86.                         client_color(0, plr, dpport)
  87.                 }
  88.         }
  89.         return FMRES_IGNORED
  90. }


  91. public fwdPlayerPostThink( plr )
  92. {
  93.         static id

  94.         for( id = 1; id <= g_iMaxPlayers; id++ )
  95.         {
  96.                 if(g_bHasSemiclip[id])
  97.                 {
  98.                         set_pev( id, pev_solid, SOLID_SLIDEBOX )
  99.                         g_bHasSemiclip[id] = false
  100.                 }
  101.         }
  102.         if(g_MsgOn[plr])
  103.         {
  104.                 g_MsgOn[plr] = false
  105.         }
  106.         if(!(pev(plr, pev_button) & IN_USE))
  107.         {
  108.                 count[plr]=0;
  109.         }
  110. }

  111. public fwdAddToFullPack_Post( es_handle, e, ent, host, hostflags, player, pset )
  112. {
  113.         if( player&&HasBuy[host]==1)
  114.         {
  115.                 if( g_bSolid[host] && g_bSolid[ent] && get_distance_f( g_fOrigin[host], g_fOrigin[ent] ) <= DISTANCE )
  116.                 {                       
  117.                         if(get_user_team(host) != get_user_team(ent))
  118.                                 return FMRES_IGNORED
  119.                         if(!(pev(host, pev_button) & IN_USE))       
  120.                                 return FMRES_IGNORED
  121.                                
  122.                         set_es( es_handle, ES_Solid, SOLID_NOT ) // makes semiclip flawless
  123.                         set_es( es_handle, ES_RenderMode, kRenderTransAlpha )
  124.                         set_es( es_handle, ES_RenderAmt, 85 )
  125.                 }
  126.         }
  127.        
  128.         return FMRES_IGNORED
  129. }

  130. public buy_antiblock(id)
  131. {
  132.         new dpport[222],D_name[32];
  133.         get_user_name(id, D_name, 31);
  134.         g_money = cs_get_user_money2(id);
  135.         if(HasBuy[id]==1)
  136.         {
  137.                 format(dpport,222,"^x03您已经获得了该道具!")
  138.                 client_color(id,id,dpport)
  139.                 return PLUGIN_HANDLED;
  140.         }
  141.         if(!is_user_alive(id)) return PLUGIN_HANDLED;
  142.         if(!is_user_connected(id)) return PLUGIN_HANDLED;
  143.         if(g_money>=300)
  144.         {
  145.                 cs_set_user_money2(id, g_money - 300)
  146.                 HasBuy[id]=1;
  147.                 format(dpport,222,"^x01【^x04提示^x01】^x03%s^01购买了^x03【^x04穿人卡^x03】^x01,现在他可以自由穿梭了!",D_name)
  148.                 client_color(0, id, dpport)
  149.         }
  150.         else if(g_money<300||HasBuy[id]==0)
  151.         {
  152.                 format(dpport,222,"^x01你没有足够的资金购买^x03【^x04穿人卡^x03】^x01!")
  153.                 client_color(id, id, dpport)
  154.         }
  155.         return PLUGIN_CONTINUE;
  156. }

  157. public client_color(playerid,colorid,msg[])
  158. {
  159.         message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, playerid)
  160.         write_byte(colorid)
  161.         write_string(msg)
  162.         message_end()
  163. }

  164. // is there a better way to detect changings of g_iCvar[0]?

复制代码
 楼主| 发表于 2016-4-1 16:49:10 | 显示全部楼层 来自 中国–湖南–长沙
如果需要其他源码的 请联系QQ 448283676
回复

使用道具 举报

发表于 2016-8-28 18:03:21 来自手机 | 显示全部楼层 来自 中国–天津–天津
不错不错不错
回复

使用道具 举报

发表于 2016-11-1 15:05:45 | 显示全部楼层 来自 中国–广东–深圳
xing9634 发表于 2016-4-1 16:49
如果需要其他源码的 请联系QQ 448283676

权限:ADMIN_LEVEL_F       输入:buy_ab 够买?  按E穿人,还是自动穿人?  
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表