#include <amxmodx>
#include <fun>
#include <zombieplague>
new const PLUGIN_NAME[] = ""
new const PLUGIN_VERSION[] = ""
new const PLUGIN_AUTHOR[] = ""
// Item ID
new g_teleport;
// Game Variables
new bool:hasTeleport[33];
new teleport_counter;
new Float:g_lastusetime[33];
// 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", "TeleportAktivalasa");
// Register new extra item
g_teleport = zp_register_extra_item("Teleport", 25, ZP_TEAM_HUMAN);
// CVARs
pcv_teleport_limit = register_cvar("zp_teleport_limit", "3");
pcv_teleport_cooldown = register_cvar("zp_teleport_cooldown", "10");
}
// Precache Files
public plugin_precache()
{
// Teleport Sound
precache_sound("warcraft3/new_teleport.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[id])
return PLUGIN_CONTINUE;
}
// Player bought our item...
public zp_extra_item_selected(owner, itemid)
{
if (itemid == g_teleport)
{
if (hasTeleport[owner])
{
client_print(owner, print_center, "Mar van ilyen tetel.");
hasTeleport[owner] = false;
}
else
{
hasTeleport[owner] = true;
teleport_counter = 0;
client_print(owner, print_chat, "[ZP] Teleport hasznalatahoz, konzolba: 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[id])
{
client_print(id, print_center, "Vegyel teleportot elsonek!");
return PLUGIN_CONTINUE;
}
// Teleport cooldown not over
if (get_gametime() - g_lastusetime[id] < get_pcvar_float(pcv_teleport_cooldown))
{
client_print(id, print_center, "Varj meg egy kicsit");
return PLUGIN_CONTINUE;
}
// Get old and new location
new OldLocation[3], NewLocation[3];
// 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[3];
get_user_origin(id, UserOrigin);
// Now create bubbles
new BubbleOrigin[3];
BubbleOrigin[0] = UserOrigin[0];
BubbleOrigin[1] = UserOrigin[1];
BubbleOrigin[2] = UserOrigin[2] + 40;
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPRITETRAIL) // TE ID
write_coord(BubbleOrigin[0]) // Start Position X
write_coord(BubbleOrigin[1]) // Start Position Y
write_coord(BubbleOrigin[2]) // Start Position Z
write_coord(UserOrigin[0]) // End Position X
write_coord(UserOrigin[1]) // End Position Y
write_coord(UserOrigin[2]) // 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[0] += ((NewLocation[0] - OldLocation[0] > 0) ? -50 : 50);
NewLocation[1] += ((NewLocation[1] - OldLocation[1] > 0) ? -50 : 50);
NewLocation[2] += 40;
// Teleport player
set_user_origin(id, NewLocation);
// Set current teleport use time
g_lastusetime[id] = get_gametime();
// Check if user has reached limit
new teleport_limit = get_pcvar_num(pcv_teleport_limit);
if (teleport_counter == teleport_limit)
{
hasTeleport[id] = 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 }
*/