搜索
查看: 2532|回复: 2

求高手帮我改一个小插件"Respawn Forever"

[复制链接]
发表于 2006-9-18 13:19:30 | 显示全部楼层 |阅读模式 来自 中国–湖南–郴州
Respawn Forever
自动重生插件。这插件有个BUG,就是观察者也有效果的。
我想去掉这个观察者也能自动重生的功能。
以下是原代码,哪位高手能帮我改改呀?


  1. /* AMXX Mod script.
  2. *
  3. * (c) Copyright 2004, developed by Geesu
  4. * This file is provided as is (no warranties).
  5. *
  6. * Changelog
  7. * 1.1:
  8. *   Added /respawn command to spawn a player if they're dead
  9. *   Added a public cvar
  10. * 1.0:
  11. *        Pistols are now given to players when they respawn
  12. *        sv_checkpistols cvar added, if this is set to 0, then players will always spawn with a pistol, otherwise they will only spawn with a pistol when it is not scoutzknivez and not a ka map
  13. *        sv_respawn cvar added, set this to 0 to disable the plugin
  14. */

  15. new const VERSION[] =        "1.1"

  16. #include <amxmodx>
  17. #include <fun>
  18. #include <cstrike>

  19. #define DISABLE_CS 0

  20. // team ids
  21. #define UNASSIGNED 0
  22. #define TS 1
  23. #define CTS 2
  24. #define AUTO_TEAM 5

  25. new bool:g_PistolsDisabled = false

  26. public plugin_init(){

  27.         register_plugin("Respawn Forever", VERSION, "Pimp Daddy (OoTOAoO)")

  28.         register_event("DeathMsg","on_Death","a")
  29.        
  30.         register_cvar("sv_checkpistols", "1")
  31.         register_cvar("sv_respawn", "1")
  32.         register_cvar("respawn_forever_version", VERSION, FCVAR_SERVER)

  33.         register_clcmd("say","on_Chat")
  34.         register_clcmd("say_team","on_Chat")
  35. }

  36. public on_Chat(id)
  37. {
  38.         if ( !get_cvar_num("sv_respawn") )
  39.         {
  40.                 client_print(id, print_chat, "* Respawn plugin disabled")
  41.                 return PLUGIN_CONTINUE
  42.         }

  43.         new szSaid[32]
  44.         read_args(szSaid, 31)

  45.         if (equali(szSaid,"^"/respawn^"") || equali(szSaid,"^"respawn^""))
  46.         {
  47.                 spawn_func(id)
  48.         }
  49. }

  50. public check_pistols()
  51. {
  52.         /* Determine if we should give players a pistol or not */
  53.         if ( get_cvar_num("sv_checkpistols") )
  54.         {
  55.                 set_task(1.0, "check_pistols")
  56.                 new mapname[32]
  57.                 get_mapname(mapname,31)
  58.                 if ( containi(mapname,"ka_")!=-1 || containi(mapname,"scoutzknivez")!=-1 )
  59.                                 g_PistolsDisabled = true
  60.         }
  61. }

  62. public spawn_func(id)
  63. {
  64.         new parm[1]
  65.         parm[0]=id
  66.        
  67.         /* Spawn the player twice to avoid the HL engine bug */
  68.         set_task(0.5,"player_spawn",72,parm,1)
  69.         set_task(0.7,"player_spawn",72,parm,1)

  70.         /* Then give them a suit and a knife */
  71.         set_task(0.9,"player_giveitems",72,parm,1)
  72. }

  73. public on_Death()
  74. {
  75.         if ( !get_cvar_num("sv_respawn") )
  76.                 return PLUGIN_CONTINUE
  77.        
  78.         new victim_id = read_data(2)
  79.        
  80.         spawn_func( victim_id )

  81.         return PLUGIN_CONTINUE
  82. }

  83. public player_giveitems(parm[1])
  84. {
  85.         new id = parm[0]

  86.         give_item(id, "item_suit")
  87.         give_item(id, "weapon_knife")

  88.         /* Determines if a players should be given a pistol */
  89.         if ( !g_PistolsDisabled )
  90.         {
  91.                 new wpnList[32] = 0, number = 0, bool:foundGlock = false, bool:foundUSP = false
  92.                 get_user_weapons(id,wpnList,number)
  93.                
  94.                 /* Determine if the player already has a pistol */
  95.                 for (new i = 0;i < number;i++)
  96.                 {
  97.                         if (wpnList[i] == CSW_GLOCK18)
  98.                                 foundGlock = true
  99.                         if (wpnList[i] == CSW_USP)
  100.                                 foundUSP = true
  101.                 }
  102.                
  103.                 /* Give a T his/her pistol */
  104.                 if ( get_user_team(id)==TS && !foundGlock )
  105.                 {
  106.                                 give_item(id,"weapon_glock18")
  107.                                 give_item(id,"ammo_9mm")
  108.                                 give_item(id,"ammo_9mm")
  109.                 }
  110.                 /* Give a CT his/her pistol */
  111.                 else if ( get_user_team(id)==CTS && !foundUSP )
  112.                 {
  113.                                 give_item(id,"weapon_usp")
  114.                                 give_item(id,"ammo_45acp")
  115.                                 give_item(id,"ammo_45acp")
  116.                 }
  117.         }

  118.         return PLUGIN_CONTINUE
  119. }

  120. public player_spawn(parm[1])
  121. {
  122.         spawn(parm[0])
  123. }
复制代码

本帖子中包含更多资源

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

×
发表于 2006-9-18 14:41:57 | 显示全部楼层 来自 中国–黑龙江–哈尔滨

回复: 求高手帮我改一个小插件&quot;Respawn Forever&quot;

  1. public spawn_func(id)
  2. {
  3.         if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
  4.                 return PLUGIN_CONTINUE
  5.        
  6.         new parm[1]
  7.         parm[0]=id
  8.        
  9.         /* Spawn the player twice to avoid the HL engine bug */
  10.         set_task(0.5,"player_spawn",72,parm,1)
  11.         set_task(0.7,"player_spawn",72,parm,1)
  12.         /* Then give them a suit and a knife */
  13.         set_task(0.9,"player_giveitems",72,parm,1)
  14.         return PLUGIN_CONTINUE
  15. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2006-9-18 15:06:11 | 显示全部楼层 来自 中国–湖南–郴州

回复: 求高手帮我改一个小插件&quot;Respawn Forever&quot;

谢谢了,不过我等不及了。把插件组都换成1.76的了。
用了respawn_controller,可以解决这个问题。
你这个我收藏了。
回复

使用道具 举报

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

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