I think frostnova.wav (frost nade's sound) is better than blinkarrival.wav and....
PHP Code:
/* Changelog:
v1.0 - First Release
v1.1 - Added bind function.
To use teleport bind a key.
Example: bind "key" teleport. (bind f teleport)
WARNING:To prevent bugs do not teleport to sky.
*/
#include <amxmodx>
#include <fun>
#include <zombieplague>
new const PLUGIN_NAME[] = "[ZP] Teleport"
new const PLUGIN_VERSION[] = "1.0"
new const PLUGIN_AUTHOR[] = "NiHiLaNTh"
// Item ID
new g_teleport;
// Game Variables
new bool:hasTeleport[33];
new teleport_counter;
// CVAR Pointer
new pcv_teleport_limit;
// 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("5 Teleports", 10, ZP_TEAM_HUMAN);
// CVAR
pcv_teleport_limit = register_cvar("zp_teleport_limit", "5");
}
// Precache Sound
public plugin_precache()
{
precache_sound("warcraft3/frostnova.wav");
}
// Player bought one of our items...
public zp_extra_item_selected(id, itemid)
{
if (itemid == g_teleport)
{
if (hasTeleport[id])
{
client_print(id, print_chat, "[ZP] You already have Teleport.");
hasTeleport[id] = false;
}
else
{
hasTeleport[id] = true;
client_cmd(id, "bind x ^"teleport^"")
client_print(id, print_chat, "[ZP] Press X to Teleport");
}
}
}
// Activate Teleport
public ActivateTeleport(id)
{
// For some reason zombie or survivor has teleport
if (zp_get_user_zombie(id))
return PLUGIN_CONTINUE;
// Check if player has bought teleport
if (!hasTeleport[id])
{
client_print(id, print_center, "[ZP] Buy Teleport first");
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);
// Increase teleport counter
teleport_counter++
// Play needed sound
emit_sound(id, CHAN_STATIC, "warcraft3/frostnova.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
// Player cannot stuck in the wall/floor or ceiling
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);
// 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;
}
/\ If you dont want lose your teleport when round start
__________________