Raised This Month: $ Target: $400
 0% 

[ZP] new class HELP


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Tonda
Senior Member
Join Date: Aug 2009
Old 06-17-2010 , 02:04   [ZP] new class HELP
Reply With Quote #1

Hi, help me pls with this Zombie class. Whhere is wrong? Plugin dont work

Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <zombieplague>
#include <fun>
#define PLUGIN "[ZP] Class - Hunter"
#define VERSION "1.1"
#define AUTHOR "yea"

// Zombie Attributes
new const zclass_name[] = "Hunter" // name
new const zclass_info[] = "- Can run very fast" // description
new const zclass_model[] = "zombie_source" // model
new const zclass_clawmodel[] = "v_knife_zombie.mdl" // claw model
const zclass_health = 2000 // health
const zclass_speed = 260 // speed
const Float:zclass_gravity = 1.15 // gravity
const Float:zclass_knockback = 2.5 // knockback
// --- config ------------------------ //
#define TRAIL_LIFE        2
#define TRAIL_WIDTH       10
#define TRAIL_RED         90
#define TRAIL_GREEN       200 
#define TRAIL_BLUE        90
#define TRAIL_BRIGTHNESS  220
new Float:g_fastspeed = 1000.0 // sprint speed
new Float:g_normspeed = 260.0 // norm speed. must be as zclass_speed
new Float:g_abilonecooldown = 20.0 // cooldown time
new Float:g_abilonelenght = 2.0 // time of sprint
new const sound_hunter_sprint[] = "zombie_plague/spells/zombie_hunter/sprint.wav" //sprint sound
// ----------------------------------- //
new i_cooldown_time[33]
new g_zclass_hunter
new g_speeded[33] = 0
new g_abil_one_used[33] = 0
new gTrail
new g_maxplayers
public plugin_precache()
{
 g_zclass_hunter = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback) 
 precache_sound(sound_hunter_sprint)
}
public plugin_init() 
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_clcmd("ability1", "use_ability_one")
 register_concmd("ability1", "use_ability_one")
 
 register_forward( FM_PlayerPreThink, "client_prethink" )
 register_logevent("roundStart", 2, "1=Round_Start")
 
 g_maxplayers = get_maxplayers()
 gTrail = engfunc(EngFunc_PrecacheModel,"sprites/smoke.spr")
}

public client_prethink(id)
{
 if (zp_get_user_zombie_class(id) == g_zclass_hunter)
 {
  if(is_user_alive(id) && zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_zclass_hunter) && !zp_get_user_nemesis(id))
  Action(id);
 }
}
public Action(id)
{
 if (g_speeded[id] == 1)
 {
  set_user_maxspeed(id , g_fastspeed); 
 }
 else
 {
  set_user_maxspeed(id , g_normspeed); 
 }
     return PLUGIN_HANDLED;
} 
public roundStart()
{
 for (new i = 1; i <= g_maxplayers; i++)
 {
  i_cooldown_time[i] = floatround(g_abilonecooldown)
  g_abil_one_used[i] = 0
  g_speeded[i] = 0
  remove_task(i)
  client_cmd(i,"cl_forwardspeed 400")
  client_cmd(i,"cl_backspeed 400")
 }
}
public ShowHUD(id)
{
 if(is_user_alive(id))
 {
  i_cooldown_time[id] = i_cooldown_time[id] - 1;
  set_hudmessage(200, 100, 0, 0.75, 0.92, 0, 1.0, 1.1, 0.0, 0.0, -1)
  show_hudmessage(id, "Sprint cooldown: %d",i_cooldown_time[id])
 }else{
  remove_task(id)
 }
}
public use_ability_one(id)
{
 if (is_user_alive(id) && (zp_get_user_zombie_class(id) == g_zclass_hunter) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
 {
  
  if(g_abil_one_used[id] == 0)
  { 
   client_cmd(id,"cl_forwardspeed 1600")
   client_cmd(id,"cl_backspeed 1600")
 
   message_begin (MSG_BROADCAST,SVC_TEMPENTITY)
   write_byte (TE_BEAMFOLLOW)
   write_short (id)
   write_short (gTrail)
   write_byte (TRAIL_LIFE)
   write_byte (TRAIL_WIDTH)
   write_byte (TRAIL_RED)
   write_byte (TRAIL_GREEN)
   write_byte (TRAIL_BLUE)
   write_byte (TRAIL_BRIGTHNESS)
   message_end()
   g_speeded[id] = 1
   emit_sound(id, CHAN_STREAM, sound_hunter_sprint, 1.0, ATTN_NORM, 0, PITCH_NORM)
   g_abil_one_used[id] = 1
   set_task(g_abilonelenght,"set_normal_speed",id)
      
   i_cooldown_time[id] = floatround(g_abilonecooldown)
   set_task(1.0, "ShowHUD", id, _, _, "a",i_cooldown_time[id])
//   client_print(id,print_chat,"[dev] - use ability")
  }  
 }
}
public set_normal_speed(id)
{
 if ((zp_get_user_zombie_class(id) == g_zclass_hunter) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
 {
  g_speeded[id] = 0
  client_cmd(id,"cl_forwardspeed 400")
  client_cmd(id,"cl_backspeed 400")
  set_task(g_abilonecooldown,"set_ability_one_cooldown",id)
//  client_print(id,print_chat,"[dev] - executed 'set normal speed' task")
 }
}
public set_ability_one_cooldown(id)
{
 if ((zp_get_user_zombie_class(id) == g_zclass_hunter) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
 {
  g_abil_one_used[id] = 0
  new text[100]
  format(text,99,"^x04[ZP]^x01 Your ability ^x04Sprint^x01 is ready.")
  message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id) 
  write_byte(id) 
  write_string(text) 
  message_end()
 }
}
public zp_user_infected_post(id, infector)
{
 if ((zp_get_user_zombie_class(id) == g_zclass_hunter) && !zp_get_user_nemesis(id))
 {
  
  new text[100]
  new note_cooldown = floatround(g_abilonecooldown)
  format(text,99,"^x04[ZP]^x01 Your ability is ^x04Sprint^x01. Cooldown:^x04 %d ^x01seconds.",note_cooldown)
  message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id) 
  write_byte(id) 
  write_string(text) 
  message_end()
  
  i_cooldown_time[id] = floatround(g_abilonecooldown)
  remove_task(id)
  g_speeded[id] = 0
  g_abil_one_used[id] = 0
  client_cmd(id,"bind F1 ability1")
 }
}
public zp_user_humanized_post(id)
{
 remove_task(id)
 client_cmd(id,"cl_forwardspeed 400")
 client_cmd(id,"cl_backspeed 400")
}
Tonda is offline
 


Thread Tools
Display Modes

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 14:52.


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