Osker Lee 大哥,帮忙改一下僵尸插件
Osker Lee ,官网有个僵尸插件," Teleport",就是人类瞬移,可是有个bug,人类可以瞬移到天空里,麻烦给修正一下,向魔兽版那样,限制瞬移的高度!#include <amxmodx>#include <fun>
#include <zombieplague>
new const PLUGIN_NAME[] = " Teleport"
new const PLUGIN_VERSION[] = "1.2"
new const PLUGIN_AUTHOR[] = "NiHiLaNTh"
// Item ID
new g_teleport;
// Game Variables
new bool:hasTeleport;
new teleport_counter;
new Float:g_lastusetime;
// CVAR Pointers
new pcv_teleport_limit, pcv_teleport_cooldown;
// Sprite Index
new BubbleSprite;
// Plugin Initialization
public plugin_init()
{
// Plugin Call
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
// Client Command
register_clcmd("teleport", "ActivateTeleport");
// Register new extra item
g_teleport = zp_register_extra_item("瞬移", 3, ZP_TEAM_HUMAN);
// CVARs
pcv_teleport_limit = register_cvar("zp_teleport_limit", "5");
pcv_teleport_cooldown = register_cvar("zp_teleport_cooldown", "10");
}
// Precache Files
public plugin_precache()
{
// Teleport Sound
precache_sound("warcraft3/blinkarrival.wav");
// Sprite
BubbleSprite = precache_model("sprites/blueflare2.spr");
}
// New round started - remove all teleports
zp_round_started(gamemode, id)
{
// On round start client cannot have our extra item
if (hasTeleport)
return PLUGIN_CONTINUE;
}
// Player bought our item...
public zp_extra_item_selected(owner, itemid)
{
if (itemid == g_teleport)
{
if (hasTeleport)
{
client_print(owner, print_center, "Already own this item.");
hasTeleport = false;
}
else
{
hasTeleport = true;
teleport_counter = 0;
client_print(owner, print_chat, " To use teleport bind a key(bind f teleport)");
}
}
}
// Activate Teleport
public ActivateTeleport(id)
{
// For some reason zombie or survivor or nemesis has teleport
if (zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_nemesis(id))
return PLUGIN_CONTINUE;
// Check if player has bought teleport
if (!hasTeleport)
{
client_print(id, print_center, "Buy teleport first");
return PLUGIN_CONTINUE;
}
// Teleport cooldown not over
if (get_gametime() - g_lastusetime < get_pcvar_float(pcv_teleport_cooldown))
{
client_print(id, print_center, "You must wait a bit.");
return PLUGIN_CONTINUE;
}
// Get old and new location
new OldLocation, NewLocation;
// Get current players location
get_user_origin(id, OldLocation);
// Get location where player is aiming(where he will be teleported)
get_user_origin(id, NewLocation, 3);
// Create bubbles in a place where player teleported
// First, get user origin
new UserOrigin;
get_user_origin(id, UserOrigin);
// Now create bubbles
new BubbleOrigin;
BubbleOrigin = UserOrigin;
BubbleOrigin = UserOrigin;
BubbleOrigin = UserOrigin + 40;
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPRITETRAIL) // TE ID
write_coord(BubbleOrigin) // Start Position X
write_coord(BubbleOrigin) // Start Position Y
write_coord(BubbleOrigin) // Start Position Z
write_coord(UserOrigin) // End Position X
write_coord(UserOrigin) // End Position Y
write_coord(UserOrigin) // End Position Z
write_short(BubbleSprite) // Sprite Index
write_byte(30) // Count
write_byte(10) // Life
write_byte(1) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end();
// Increase teleport counter
teleport_counter++
// Play needed sound
emit_sound(id, CHAN_STATIC, "warcraft3/blinkarrival.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
// Player cannot stuck in the wall/floor
NewLocation += ((NewLocation - OldLocation > 0) ? -50 : 50);
NewLocation += ((NewLocation - OldLocation > 0) ? -50 : 50);
NewLocation += 40;
// Teleport player
set_user_origin(id, NewLocation);
// Set current teleport use time
g_lastusetime = get_gametime();
// Check if user has reached limit
new teleport_limit = get_pcvar_num(pcv_teleport_limit);
if (teleport_counter == teleport_limit)
{
hasTeleport = false;
}
return PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
等待r版主等高手吧 本帖最后由 Osker Lee 于 2011-8-30 19:33 编辑
在魔兽插件V3.0_RC13里人族要是传送到禁止的区域(比如天空),是被立即处死的,而且如果要限制某些地图的传送区域,要在源码里添加相应的地图坐标参数,你看一下war3ft/race_human.inl这个文件就知道了。不过,你可以试一下下面这个传送弹插件,买个烟雾弹然后扔出去,烟雾弹扔到哪你就可以传送到哪了,没有什么BUG。
【备注】
这个传送插件用在僵尸模式里会和照明弹有冲突,所以建议在zombieplague.cfg里把照明弹的功能关闭。
zp_flare_grenades 0 // 开启照明弹 (就是烟雾弹) 谢谢了,不过还是希望完善一下此插件!
页:
[1]