搜索
查看: 3071|回复: 7

求OP能在基地回血的插件,如图。非常感谢!

[复制链接]
发表于 2011-11-24 04:29:56 | 显示全部楼层 |阅读模式 来自 广东珠海





希望能发源码,非常感谢。
发表于 2011-11-24 17:45:13 | 显示全部楼层 来自 广东广州
去翻一下发布区03年至05年的帖子可找到这东西了..以前发过一次的了
回复

使用道具 举报

发表于 2011-11-24 19:43:05 | 显示全部楼层 来自 云南西双版纳州景洪
回复

使用道具 举报

发表于 2011-11-25 10:07:21 | 显示全部楼层 来自 河南郑州
呵呵、、有意思、、
回复

使用道具 举报

发表于 2011-11-25 10:48:43 | 显示全部楼层 来自 河南
编译不了、
回复

使用道具 举报

 楼主| 发表于 2011-11-25 13:42:48 | 显示全部楼层 来自 广东珠海
本帖最后由 coolhurter 于 2011-11-27 00:20 编辑

  1. /* AMX Mod script.
  2. *
  3. *  Health Replinish
  4. *  (C)2003 by GeekGod Industries, this script is provided as is (No Warranties)
  5. *  Based on Jailbreak by SpaceDude, rewritten to only handle health recharges
  6. *
  7. */

  8. #include <amxmodx>
  9. #include <amxmisc>
  10. #include <engine>
  11. #include <cstrike>
  12. #include <fun>



  13. #define TE_BEAMPOINTS 0
  14. #define TE_SPRITETRAIL 15
  15. #define HEALTHSIZE 40
  16. #define HEALTHLIFE 20     // seconds*10
  17. #define HEALTHBEAMWIDTH 15
  18. #define HEALTHBEAMNOISE 0
  19. #define HEALTHBEAMBRIGHTNESS 64
  20. #define RESCUETIME 30.0
  21. #define MAXESCAPEATTEMPTS 3
  22. #define BURYDEPTH 40
  23. #define RESCUECOUNTDOWN 5

  24. new bool:THealthSet       // Terrorist = Team 1
  25. new bool:CTHealthSet      // Counter-Terrorist = Team 2
  26. new THealthCoords[3]
  27. new CTHealthCoords[3]
  28. new PlayerCoords[33]
  29. new bool:IsInHealth[33]
  30. new bool:CheckIfStuck[33]
  31. new bool:IsBuried[33]
  32. new EscapeAttempts[33]

  33. new HealthBeam
  34. //new flaresprite
  35. //new gmsgDeathMsg
  36. new gmsgScoreAttrib

  37. public new_round(id)
  38. {
  39.         if (get_cvar_num("gg_replinishhealth")==0) return PLUGIN_CONTINUE
  40.         new teamnumber=get_user_team(id)
  41.         if (teamnumber==1 && !THealthSet)
  42.                 {
  43.                 get_user_origin(id, THealthCoords)
  44.                 THealthSet=true
  45.         }
  46.         else if (teamnumber==2 && !CTHealthSet)
  47.                 {
  48.                 get_user_origin(id, CTHealthCoords)
  49.                 CTHealthSet=true
  50.         }
  51.         IsInHealth[id]=false
  52.         IsBuried[id]=false
  53.         EscapeAttempts[id]=0
  54.         CheckIfStuck[id]=false
  55.         set_user_godmode(id)
  56.         set_user_rendering(id)
  57.         return PLUGIN_CONTINUE
  58. }


  59. public create_health_box(){
  60.         if (get_cvar_num("gg_replinishhealth")==0) return PLUGIN_CONTINUE
  61.         new red, green, blue
  62.         new origin[3]
  63.         new x1, y1, x2, y2, height
  64.         new i, j, k
  65.         new shape[4][2] = {{1,1},{-1,1},{-1,-1},{1,-1}}
  66.         for (j=0; j<4; j++){
  67.                 height=30*j-30
  68.                 for (i=0; i<4; i++){
  69.                         x1=shape[i][0]*HEALTHSIZE
  70.                         y1=shape[i][1]*HEALTHSIZE
  71.                         if (i<3){
  72.                                 x2=shape[i+1][0]*HEALTHSIZE
  73.                                 y2=shape[i+1][1]*HEALTHSIZE
  74.                         }
  75.                         else{
  76.                                 x2=shape[0][0]*HEALTHSIZE
  77.                                 y2=shape[0][1]*HEALTHSIZE
  78.                         }
  79.                         for (k=1; k<3; k++){
  80.                                 if (k==1){
  81.                                         copy(origin,3,THealthCoords)
  82.                                         red=255
  83.                                         green=0
  84.                                         blue=0
  85.                                 }
  86.                                 else if (k==2){
  87.                                         copy(origin,3,CTHealthCoords)
  88.                                         red=0
  89.                                         green=0
  90.                                         blue=255
  91.                                 }
  92.                                 message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
  93.                                 write_byte( TE_BEAMPOINTS )
  94.                                 write_coord(origin[0]+x1)
  95.                                 write_coord(origin[1]+y1)
  96.                                 write_coord(origin[2]+height)
  97.                                 write_coord(origin[0]+x2)
  98.                                 write_coord(origin[1]+y2)
  99.                                 write_coord(origin[2]+height)
  100.                                 write_short(HealthBeam)   // model
  101.                                 write_byte( 0 ) // start frame
  102.                                 write_byte( 0 ) // framerate
  103.                                 write_byte( HEALTHLIFE ) // life
  104.                                 write_byte( HEALTHBEAMWIDTH )  // width
  105.                                 write_byte( HEALTHBEAMNOISE )   // noise
  106.                                 write_byte( red )   // r, g, b
  107.                                 write_byte( green )   // r, g, b
  108.                                 write_byte( blue )   // r, g, b
  109.                                 write_byte( HEALTHBEAMBRIGHTNESS )        // brightness
  110.                                 write_byte( 0 )         // speed
  111.                                 message_end()
  112.                         }
  113.                 }
  114.         }
  115.         return PLUGIN_CONTINUE
  116. }

  117. public check_position(){
  118.         if (get_cvar_num("gg_replinishhealth")==0) return PLUGIN_CONTINUE
  119.         new origin[3], playerorigin[3], players[32]
  120.         new i, numofplayers, id
  121.         new teamnumber
  122.         get_players(players, numofplayers)
  123.         for (i=0; i<numofplayers; i++){
  124.                 id=players[i]
  125.                 if (!is_user_alive(id)) continue
  126.                 get_user_origin(id, playerorigin)
  127.                 teamnumber = get_user_team(id)
  128.                 if (teamnumber==2)
  129.                                 {
  130.                         copy(origin,3,CTHealthCoords)
  131.                 }
  132.                 else if (teamnumber==1)
  133.                                 {
  134.                         copy(origin,3,THealthCoords)
  135.                 }
  136.                 if (CheckIfStuck[id] && PlayerCoords[id]==playerorigin[2]){
  137.                         origin[0]+=random_num(-HEALTHSIZE+20,HEALTHSIZE-20)
  138.                         origin[1]+=random_num(-HEALTHSIZE+20,HEALTHSIZE-20)
  139.                         origin[2]+=1            // Avoid getting teleported all over the place on certain maps
  140.                         set_user_origin(id, origin)
  141.                         PlayerCoords[id]=origin[2]
  142.                         CheckIfStuck[id]=true
  143.                 }
  144.                 CheckIfStuck[id]=false
  145.                 if(!(origin[0]-playerorigin[0] > HEALTHSIZE || origin[0]-playerorigin[0] < -HEALTHSIZE ||
  146.                   origin[1]-playerorigin[1] > HEALTHSIZE || origin[1]-playerorigin[1] < -HEALTHSIZE ||
  147.                   origin[2]-playerorigin[2] > HEALTHSIZE || origin[2]-playerorigin[2] < -HEALTHSIZE))
  148.                                 {
  149.                                                 // person is in health box, replinish health by 5 or 10
  150.                                                 if(get_user_health(id)<100)
  151.                                                 {
  152.                                                         set_user_health(id,get_user_health(id)+5)
  153.                                                         cs_set_user_money(id,cs_get_user_money(id)+1000)
  154.                                                         client_print(id,print_chat,"[AMX] Increasing health by 5 points");
  155.                                                         if(get_user_health(id)>99)
  156.                                                         {
  157.                                                                 client_print(id,print_chat,"[AMX] Health is now maxed.  Go fight!");
  158.                                                                 client_cmd(id, "spk ^"fvox/administering_medical^"")
  159.                                                         }
  160.                                                 }
  161.                                 }
  162.         }
  163.         return PLUGIN_CONTINUE
  164. }

  165. public end_round(){
  166.         if (get_cvar_num("gg_replinishhealth")==0) return PLUGIN_CONTINUE
  167.         THealthSet=false
  168.         CTHealthSet=false
  169.         return PLUGIN_CONTINUE
  170. }

  171. public scoreboard(id,state){    // 0 - nothing, 1 - dead, 2 - bomb
  172.         message_begin( MSG_ALL, gmsgScoreAttrib,{0,0,0},0)
  173.         write_byte(id)
  174.         write_byte(state)
  175.         message_end()
  176.         return PLUGIN_HANDLED
  177. }

  178. public client_connect(id){
  179.         if (get_cvar_num("gg_replinishhealth")==0) return PLUGIN_CONTINUE
  180.         IsInHealth[id]=false
  181.         return PLUGIN_CONTINUE
  182. }

  183. public plugin_precache(){
  184.         HealthBeam = precache_model("sprites/zbeam4.spr")
  185.         //flaresprite = precache_model( "sprites/blueflare2.spr")
  186.         return PLUGIN_CONTINUE
  187. }

  188. public plugin_init()
  189. {
  190.         //gmsgDeathMsg = get_user_msgid("DeathMsg")
  191.         gmsgScoreAttrib = get_user_msgid("ScoreAttrib")
  192.         register_plugin("Health Replinish","0.1.0","GeekGod")
  193.         register_cvar("Health_Replinish","1.02",FCVAR_SERVER)
  194.         register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
  195.         register_event("ResetHUD", "new_round", "b")
  196.         register_cvar("gg_replinishhealth","1",0)
  197.         set_task(2.5,"create_health_box",987,"",0,"b")
  198.         set_task(1.0,"check_position",963,"",0,"b")
  199.         return PLUGIN_CONTINUE
  200. }

复制代码
提示两处错误,无法编译。
  1. //AMXXPC compile.exe
  2. // by the AMX Mod X Dev Team


  3. //// health_replinish.sma
  4. // D:\Program Files\CS1.6标准版\cstrike\addons\amxmodx\scripting\health_replinis
  5. h.sma(184) : error 010: invalid function or declaration
  6. // D:\Program Files\CS1.6标准版\cstrike\addons\amxmodx\scripting\health_replinis
  7. h.sma(187) : error 029: invalid expression, assumed zero
  8. //
  9. // 2 Errors.
  10. // Could not locate output file D:\Program Files\CS1.6标准版\cstrike\addons\amxm
  11. odx\scripting\compiled\health_replinish.amx (compile failed).
  12. //
  13. // Compilation Time: 0.12 sec
  14. // ----------------------------------------

  15. Press enter to exit ...

复制代码
希望帮忙解决下。
回复

使用道具 举报

 楼主| 发表于 2011-11-25 13:45:10 | 显示全部楼层 来自 广东珠海
  1. public scoreboard(id,state){    // 0 - nothing, 1 - dead, 2 - bomb

  2.         message_begin( MSG_ALL, gmsgScoreAttrib,{0,0,0},0)

  3.         write_byte(id)

  4.         write_byte(state)

  5.         message_end()

  6.         return PLUGIN_HANDLED

  7. }

复制代码
是这行吧,我注释掉这行。编译有个错误,但是插件能用。
回复

使用道具 举报

发表于 2011-11-25 22:28:56 | 显示全部楼层 来自 云南西双版纳州景洪
试试瞧行不行

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

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

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