搜索
查看: 3281|回复: 3

Osker Lee 大哥,帮忙改一下僵尸插件

[复制链接]
发表于 2011-8-29 10:45:03 | 显示全部楼层 |阅读模式 来自 内蒙古巴彦淖尔
Osker Lee ,官网有个僵尸插件,"[ZP] Teleport",就是人类瞬移,可是有个bug,人类可以瞬移到天空里,麻烦给修正一下,向魔兽版那样,限制瞬移的高度!
  1. #include <amxmodx>
  2. #include <fun>
  3. #include <zombieplague>

  4. new const PLUGIN_NAME[] = "[ZP] Teleport"
  5. new const PLUGIN_VERSION[] = "1.2"
  6. new const PLUGIN_AUTHOR[] = "NiHiLaNTh"

  7. // Item ID
  8. new g_teleport;

  9. // Game Variables
  10. new bool:hasTeleport[33];
  11. new teleport_counter;
  12. new Float:g_lastusetime[33];

  13. // CVAR Pointers
  14. new pcv_teleport_limit, pcv_teleport_cooldown;

  15. // Sprite Index
  16. new BubbleSprite;

  17. // Plugin Initialization
  18. public plugin_init()
  19. {
  20.         // Plugin Call
  21.         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  22.        
  23.         // Client Command
  24.         register_clcmd("teleport", "ActivateTeleport");
  25.        
  26.         // Register new extra item
  27.         g_teleport = zp_register_extra_item("瞬移", 3, ZP_TEAM_HUMAN);
  28.        
  29.         // CVARs
  30.         pcv_teleport_limit = register_cvar("zp_teleport_limit", "5");
  31.         pcv_teleport_cooldown = register_cvar("zp_teleport_cooldown", "10");
  32. }

  33. // Precache Files
  34. public plugin_precache()
  35. {
  36.         // Teleport Sound
  37.         precache_sound("warcraft3/blinkarrival.wav");
  38.        
  39.         // Sprite
  40.         BubbleSprite = precache_model("sprites/blueflare2.spr");
  41. }

  42. // New round started - remove all teleports
  43. zp_round_started(gamemode, id)
  44. {               
  45.         // On round start client cannot have our extra item
  46.         if (hasTeleport[id])
  47.                 return PLUGIN_CONTINUE;
  48. }
  49.        
  50. // Player bought our item...
  51. public zp_extra_item_selected(owner, itemid)
  52. {
  53.         if (itemid == g_teleport)
  54.         {
  55.                 if (hasTeleport[owner])
  56.                 {
  57.                         client_print(owner, print_center, "Already own this item.");
  58.                         hasTeleport[owner] = false;
  59.                 }
  60.                 else
  61.                 {
  62.                         hasTeleport[owner] = true;
  63.                         teleport_counter = 0;
  64.                         client_print(owner, print_chat, "[ZP] To use teleport bind a key(bind f teleport)");
  65.                 }
  66.         }
  67. }

  68. // Activate Teleport
  69. public ActivateTeleport(id)
  70. {
  71.         // For some reason zombie or survivor or nemesis has teleport
  72.         if (zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id))
  73.                 return PLUGIN_CONTINUE;
  74.                
  75.         // Check if player has bought teleport
  76.         if (!hasTeleport[id])
  77.         {
  78.                 client_print(id, print_center, "Buy teleport first");
  79.                 return PLUGIN_CONTINUE;
  80.         }
  81.        
  82.         // Teleport cooldown not over       
  83.         if (get_gametime() - g_lastusetime[id] < get_pcvar_float(pcv_teleport_cooldown))
  84.         {
  85.                 client_print(id, print_center, "You must wait a bit.");
  86.                 return PLUGIN_CONTINUE;
  87.         }
  88.                
  89.         // Get old and new location
  90.         new OldLocation[3], NewLocation[3];
  91.        
  92.         // Get current players location
  93.         get_user_origin(id, OldLocation);
  94.        
  95.         // Get location where player is aiming(where he will be teleported)
  96.         get_user_origin(id, NewLocation, 3);
  97.        
  98.         // Create bubbles in a place where player teleported
  99.         // First, get user origin
  100.         new UserOrigin[3];
  101.         get_user_origin(id, UserOrigin);
  102.        
  103.         // Now create bubbles
  104.         new BubbleOrigin[3];
  105.         BubbleOrigin[0] = UserOrigin[0];
  106.         BubbleOrigin[1] = UserOrigin[1];
  107.         BubbleOrigin[2] = UserOrigin[2] + 40;
  108.        
  109.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  110.         write_byte(TE_SPRITETRAIL) // TE ID
  111.         write_coord(BubbleOrigin[0]) // Start Position X
  112.         write_coord(BubbleOrigin[1]) // Start Position Y
  113.         write_coord(BubbleOrigin[2]) // Start Position Z
  114.         write_coord(UserOrigin[0]) // End Position X
  115.         write_coord(UserOrigin[1]) // End Position Y
  116.         write_coord(UserOrigin[2]) // End Position Z
  117.         write_short(BubbleSprite) // Sprite Index
  118.         write_byte(30) // Count
  119.         write_byte(10) // Life
  120.         write_byte(1) // Scale
  121.         write_byte(50) // Velocity Along Vector
  122.         write_byte(10) // Rendomness of Velocity
  123.         message_end();

  124.         // Increase teleport counter
  125.         teleport_counter++
  126.        
  127.         // Play needed sound
  128.         emit_sound(id, CHAN_STATIC, "warcraft3/blinkarrival.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  129.        
  130.         // Player cannot stuck in the wall/floor
  131.         NewLocation[0] += ((NewLocation[0] - OldLocation[0] > 0) ? -50 : 50);
  132.         NewLocation[1] += ((NewLocation[1] - OldLocation[1] > 0) ? -50 : 50);
  133.         NewLocation[2] += 40;
  134.        
  135.         // Teleport player
  136.         set_user_origin(id, NewLocation);
  137.        
  138.         // Set current teleport use time
  139.         g_lastusetime[id] = get_gametime();
  140.        
  141.         // Check if user has reached limit
  142.         new teleport_limit = get_pcvar_num(pcv_teleport_limit);
  143.         if (teleport_counter == teleport_limit)
  144.         {
  145.                 hasTeleport[id] = false;
  146.         }
  147.        
  148.         return PLUGIN_CONTINUE;
  149. }
  150. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  151. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
  152. */
复制代码
发表于 2011-8-30 09:18:01 | 显示全部楼层 来自 山东枣庄
等待r版主等高手吧
回复

使用道具 举报

发表于 2011-8-30 18:51:42 | 显示全部楼层 来自 湖北武汉
本帖最后由 Osker Lee 于 2011-8-30 19:33 编辑

在魔兽插件V3.0_RC13里人族要是传送到禁止的区域(比如天空),是被立即处死的,而且如果要限制某些地图的传送区域,要在源码里添加相应的地图坐标参数,你看一下war3ft/race_human.inl这个文件就知道了。不过,你可以试一下下面这个传送弹插件,买个烟雾弹然后扔出去,烟雾弹扔到哪你就可以传送到哪了,没有什么BUG。

【备注】
这个传送插件用在僵尸模式里会和照明弹有冲突,所以建议在zombieplague.cfg里把照明弹的功能关闭。
zp_flare_grenades 0                       // 开启照明弹 (就是烟雾弹)

本帖子中包含更多资源

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

×
回复

使用道具 举报

 楼主| 发表于 2011-8-31 08:24:51 | 显示全部楼层 来自 内蒙古巴彦淖尔
谢谢了,不过还是希望完善一下此插件!
回复

使用道具 举报

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

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