搜索
查看: 1477|回复: 0

能否帮我改改这个自动重生插件

[复制链接]
发表于 2006-12-16 17:39:54 | 显示全部楼层 |阅读模式 来自 中国–湖南–郴州
  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.         if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)
  65.         return PLUGIN_CONTINUE
  66.         new parm[1]
  67.         parm[0]=id
  68.        
  69.         /* Spawn the player twice to avoid the HL engine bug */
  70.         set_task(0.5,"player_spawn",72,parm,1)
  71.         set_task(0.7,"player_spawn",72,parm,1)

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

  75. public quick_respawn(svIndex[])
  76.         {
  77.         new vIndex = svIndex[0]
  78.         if (!is_user_alive(vIndex) && ((get_user_team(vIndex)==1) || (get_user_team(vIndex)==2))) {
  79.                 //spawn(vIndex)
  80.                 set_task(0.1, "respawn", 0, svIndex, 2)
  81.         }       
  82.         return PLUGIN_CONTINUE
  83. }

  84. public respawn(svIndex[])
  85.         {
  86.         new vIndex = svIndex[0]
  87.        
  88.         //if (get_user_team(vIndex)==3) {
  89.         if ((get_user_team(vIndex)==3)||(!is_user_connected(vIndex))||is_user_connecting(vIndex)) {
  90.                 return PLUGIN_CONTINUE
  91.                 } else {
  92.                 if (get_user_team(vIndex) == 1 || get_user_team(vIndex) == 2) {
  93.                         spawn(vIndex)
  94.                         isSpawning[vIndex] = true
  95.                         new Float:Time = get_cvar_float("csdm_freeze_time")
  96.                         get_user_origin(vIndex, Origins[vIndex])
  97.                         if (get_cvar_num("csdm_spawn_protect")==0)
  98.                                 set_task(0.05, "unfreeze", 0, svIndex, 2)
  99.                         else
  100.                                 set_task(Time, "unfreeze", 0, svIndex, 2)
  101.                         if (get_cvar_num("csdm_spawn_spam")) {
  102.                                 //client_print(vIndex, print_chat, "[CSDM] Counter-Strike Deathmatch Visit www.lambdacore.net and www.dt-club.net for more information.")
  103.                                 //client_print(vIndex, print_chat, "[CSDM] 输入命令: ^"respawn^" 可以获得重生.")
  104.                                 if (get_cvar_num("csdm_allow_clguns")) {
  105.                                         client_print(vIndex, print_chat, "[CSDM] 输入^"guns^"开启选枪菜单, ^"give 武器名^" 得到指定的武嗿")
  106.                                 }
  107.                         }
  108.                         if (get_cvar_num("csdm_spawn_protect")>0) {
  109.                                 set_user_health(vIndex, 10239)
  110.                                 if (get_cvar_num("csdm_kill_all") == 1)
  111.                                         set_user_rendering(vIndex, kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 30)
  112.                                 else if (get_user_team(vIndex) == 1)
  113.                                         set_user_rendering(vIndex, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 30)
  114.                                 else if (get_user_team(vIndex) == 2)
  115.                                         set_user_rendering(vIndex, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 30)
  116.                                 if (get_cvar_num("csdm_spawn_protect")==1) {
  117.                                         set_task(0.2, "check_move", 0, svIndex, 2, "a", floatround(Time/0.25))
  118.                                 }
  119.                         }
  120.                         } else {
  121.                         return PLUGIN_CONTINUE
  122.                 }
  123.         }
  124.        
  125.         return PLUGIN_CONTINUE
  126. }

  127. public on_Death()
  128. {
  129.         if ( !get_cvar_num("sv_respawn") )
  130.                 return PLUGIN_CONTINUE
  131.        
  132.         new victim_id = read_data(2)
  133.        
  134.         spawn_func( victim_id )

  135.         return PLUGIN_CONTINUE
  136. }

  137. public player_giveitems(parm[1])
  138. {
  139.         new id = parm[0]

  140.         give_item(id, "item_suit")
  141.         give_item(id, "weapon_knife")

  142.         /* Determines if a players should be given a pistol */
  143.         if ( !g_PistolsDisabled )
  144.         {
  145.                 new wpnList[32] = 0, number = 0, bool:foundGlock = false, bool:foundUSP = false
  146.                 get_user_weapons(id,wpnList,number)
  147.                
  148.                 /* Determine if the player already has a pistol */
  149.                 for (new i = 0;i < number;i++)
  150.                 {
  151.                         if (wpnList[i] == CSW_GLOCK18)
  152.                                 foundGlock = true
  153.                         if (wpnList[i] == CSW_USP)
  154.                                 foundUSP = true
  155.                 }
  156.                
  157.                 /* Give a T his/her pistol */
  158.                 if ( get_user_team(id)==TS && !foundGlock )
  159.                 {
  160.                                 give_item(id,"weapon_glock18")
  161.                                 give_item(id,"ammo_9mm")
  162.                                 give_item(id,"ammo_9mm")
  163.                 }
  164.                 /* Give a CT his/her pistol */
  165.                 else if ( get_user_team(id)==CTS && !foundUSP )
  166.                 {
  167.                                 give_item(id,"weapon_usp")
  168.                                 give_item(id,"ammo_45acp")
  169.                                 give_item(id,"ammo_45acp")
  170.                 }
  171.         }

  172.         return PLUGIN_CONTINUE
  173. }

  174. public player_spawn(parm[1])
  175. {
  176.         spawn(parm[0])
  177. }
复制代码


我想在这个插件里面加上CSDM里面的出生保护功能,版主可否抽时间帮我改改。谢谢!

本帖子中包含更多资源

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

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

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