Raised This Month: $ Target: $400
 0% 

Subplugin Submission [ZP] Extra Item: Teleport v1.2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pach
Senior Member
Join Date: Feb 2009
Location: Russian Federation
Old 05-06-2009 , 05:56   Re: [ZP] Extra Item: Teleport
Reply With Quote #1

Quote:
Originally Posted by Bummps View Post
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_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR);
 
 
// Client Command
 
register_clcmd("teleport""ActivateTeleport");
 
 
// Register new extra item
 
g_teleport zp_register_extra_item("5 Teleports"10ZP_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(iditemid)
{
 if (
itemid == g_teleport)
 {
  if (
hasTeleport[id])
  {
   
client_print(idprint_chat"[ZP] You already have Teleport.");
   
hasTeleport[id] = false;
  }
  else
  {
   
hasTeleport[id] = true;
   
client_cmd(id"bind x ^"teleport^"")
   
client_print(idprint_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(idprint_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(idOldLocation);
 
 
// Get location where player is aiming(where he will be teleported)
 
get_user_origin(idNewLocation3);
 
// Increase teleport counter
 
teleport_counter++
 
 
// Play needed sound
 
emit_sound(idCHAN_STATIC"warcraft3/frostnova.wav"VOL_NORMATTN_NORM0PITCH_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(idNewLocation);
 
 
// 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
Has found out an error! It is possible to use a teleport not 5 times, and unlimited quantity correct only on 5 times for one round.
__________________
Sorry for my bad English.
Pach is offline
Send a message via ICQ to Pach Send a message via Skype™ to Pach
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode