|
Veteran Member
Join Date: May 2011
Location: Malaysia
|

08-09-2011
, 12:08
Re: [zp] nst tank -> zp
|
#3
|
Quote:
Originally Posted by yokomo
Try it.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#include <fun>
#define PLUGIN "NST Zombie Class Tank"
#define VERSION "1.0"
#define AUTHOR "NST"
new spr_skill[] = "g_fastrun"
new g_zclass_sprint
new const zclass_name[] = "Tank" // name
new const zclass_info[] = "Normal Zombie" // description
new const zclass_model[] = "tank_zombi_host" // model
new const zclass_clawmodel[] = "v_knife_tank_zombi.mdl" // claw model
const zclass_health = 2000
const zclass_speed = 240
const Float:zclass_gravity = 0.9
const Float:zclass_knockback = 2.0
new Float:fastrun_time = 8.0
new Float:fastrun_timewait = 20.0
new Float:fastrun_speed = 350.0
new const sound_fastrun_start[] = "zombi/zombi_pressure.wav"
new const sound_fastrun_heartbeat[2][] = { "zombi/zombi_pre_idle_1.wav" , "zombi/zombi_pre_idle_2.wav" }
//new Array:fastrun_glowshell_color = "255,003,000"
const fastrun_glowshell_color_r = 255
const fastrun_glowshell_color_g = 3
const fastrun_glowshell_color_b = 0
//new Array:fastrun_fov = 105
const fastrun_fov = 105
new g_fastrun[33], g_fastrun_wait[33], g_check[33], g_msgStatusIcon, g_current_speed[33]
// Task offsets
enum (+= 100)
{
TASK_FASTRUN = 2000,
TASK_FASTRUN_HEARTBEAT,
TASK_FASTRUN_WAIT,
TASK_BOT_USE_SKILL
}
// IDs inside tasks
#define ID_FASTRUN (taskid - TASK_FASTRUN)
#define ID_FASTRUN_HEARTBEAT (taskid - TASK_FASTRUN_HEARTBEAT)
#define ID_FASTRUN_WAIT (taskid - TASK_FASTRUN_WAIT)
#define ID_BOT_USE_SKILL (taskid - TASK_BOT_USE_SKILL)
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
// Language files
register_dictionary("zombie_plague.txt")
// msg
g_msgStatusIcon = get_user_msgid("StatusIcon")
// Events
register_logevent("logevent_round_start",2, "1=Round_Start")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("DeathMsg", "Death", "a")
register_forward(FM_CmdStart, "fw_CmdStart")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
register_forward(FM_EmitSound, "EmitSound")
// clien cmd
//register_concmd("ww", "ww")
register_clcmd("drop", "cmd_fastrun")
}
public plugin_precache()
{
precache_sound(sound_fastrun_start)
engfunc(EngFunc_PrecacheSound, sound_fastrun_start)
// register zombie class
g_zclass_sprint = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}
public event_round_start()
{
for (new id=1; id<33; id++)
{
if (!is_user_connected(id)) continue;
reset_value_player(id)
StatusIcon(id, spr_skill, 0)
}
}
public logevent_round_start()
{
for (new id=1; id<33; id++)
{
if (!is_user_connected(id)) continue;
if (is_user_bot(id))
{
if (task_exists(id+TASK_BOT_USE_SKILL)) remove_task(id+TASK_BOT_USE_SKILL)
set_task(float(random_num(5,15)), "bot_use_skill", id+TASK_BOT_USE_SKILL)
}
}
}
public Death()
{
new victim = read_data(2)
StatusIcon(victim, spr_skill, 0)
reset_value_player(victim)
}
reset_value_player(id)
{
if (task_exists(id+TASK_FASTRUN)) remove_task(id+TASK_FASTRUN)
if (task_exists(id+TASK_FASTRUN_HEARTBEAT)) remove_task(id+TASK_FASTRUN_HEARTBEAT)
if (task_exists(id+TASK_FASTRUN_WAIT)) remove_task(id+TASK_FASTRUN_WAIT)
if (task_exists(id+TASK_BOT_USE_SKILL)) remove_task(id+TASK_BOT_USE_SKILL)
g_fastrun[id] = 0
g_fastrun_wait[id] = 0
g_check[id] = 0
}
// bot use skill
public bot_use_skill(taskid)
{
new id = ID_BOT_USE_SKILL
if (!is_user_bot(id)) return;
cmd_fastrun(id)
if (task_exists(taskid)) remove_task(taskid)
set_task(float(random_num(5,15)), "bot_use_skill", id+TASK_BOT_USE_SKILL)
}
// #################### FASTRUN PUBLIC ####################
// Cmd fast run
public cmd_fastrun(id)
{
if (g_zclass_sprint==zp_get_user_zombie_class(id) && zp_get_user_zombie(id) && !g_fastrun[id] && !g_fastrun_wait[id])
{
// set current speed
pev(id, pev_maxspeed, g_current_speed[id])
// set fastrun
g_fastrun[id] = 1
// set glow shell
/*new color[3]
color[0] = ArrayGetCell(fastrun_glowshell_color, 0)
color[1] = ArrayGetCell(fastrun_glowshell_color, 1)
color[2] = ArrayGetCell(fastrun_glowshell_color, 2)*/
fm_set_rendering(id, kRenderFxGlowShell, fastrun_glowshell_color_r, fastrun_glowshell_color_g, fastrun_glowshell_color_b, kRenderNormal, 0)
// set effect
EffectFastrun(id, fastrun_fov)
// task fastrun
new Float:timerun
timerun = fastrun_time
if (task_exists(id+TASK_FASTRUN)) remove_task(id+TASK_FASTRUN)
set_task(timerun, "RemoveFastRun", id+TASK_FASTRUN)
// play sound start
engfunc(EngFunc_EmitSound, id, CHAN_AUTO, sound_fastrun_start, 1.0, ATTN_NORM, 0, PITCH_NORM)
// task fastrun sound heartbeat
if (task_exists(id+TASK_FASTRUN_HEARTBEAT)) remove_task(id+TASK_FASTRUN_HEARTBEAT)
set_task(2.0, "FastRunHeartBeat", id+TASK_FASTRUN_HEARTBEAT, _, _, "b")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public RemoveFastRun(taskid)
{
new id = ID_FASTRUN
g_fastrun[id] = 0
set_pev(id, pev_maxspeed, g_current_speed[id])
fm_set_rendering(id)
EffectFastrun(id)
if (task_exists(taskid)) remove_task(taskid)
new Float:timewait = fastrun_timewait
timewait = 0.5
g_fastrun_wait[id] = 1
if (task_exists(id+TASK_FASTRUN_WAIT)) remove_task(id+TASK_FASTRUN_WAIT)
set_task(timewait, "RemoveWaitFastRun", id+TASK_FASTRUN_WAIT)
}
public RemoveWaitFastRun(taskid)
{
new id = ID_FASTRUN_WAIT
g_fastrun_wait[id] = 0
if (task_exists(taskid)) remove_task(taskid)
}
public FastRunHeartBeat(taskid)
{
new id = ID_FASTRUN_HEARTBEAT
if (g_fastrun[id])
engfunc(EngFunc_EmitSound, id, CHAN_AUTO, sound_fastrun_heartbeat, 1.0, ATTN_NORM, 0, PITCH_NORM)
else if (task_exists(taskid)) remove_task(taskid)
}
// show hide spr
public fw_CmdStart(id, uc_handle, seed)
{
if (!is_user_alive(id)) return;
if (g_zclass_sprint==zp_get_user_zombie_class(id) && zp_get_user_zombie(id))
{
// show status icon help
if ( (g_fastrun[id] || g_fastrun_wait[id]) && g_check[id] != 2)
{
g_check[id] = 2
StatusIcon(id, spr_skill, 2)
}
else if (g_check[id] != 1)
{
g_check[id] = 1
StatusIcon(id, spr_skill, 1)
}
}
else if (g_check[id])
{
// hide status icon
g_check[id] = 0
StatusIcon(id, spr_skill, 0)
}
return;
}
// set speed
public fw_PlayerPreThink(id)
{
if (!is_user_alive(id)) return;
if (g_zclass_sprint==zp_get_user_zombie_class(id) && zp_get_user_zombie(id) && g_fastrun[id])
{
set_pev(id, pev_maxspeed, fastrun_speed)
}
}
// MAIN FUNCTION
StatusIcon(id, sprname[], run)
{
if (!is_user_connected(id)) return;
message_begin(MSG_ONE, g_msgStatusIcon, {0,0,0}, id);
write_byte(run); // status (0=hide, 1=show, 2=flash)
write_string(sprname); // sprite name
message_end();
}
fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
new Float:RenderColor[3];
RenderColor[0] = float(r);
RenderColor[1] = float(g);
RenderColor[2] = float(b);
set_pev(entity, pev_renderfx, fx);
set_pev(entity, pev_rendercolor, RenderColor);
set_pev(entity, pev_rendermode, render);
set_pev(entity, pev_renderamt, float(amount));
return 1;
}
EffectFastrun(id, num = 90)
{
message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
write_byte(num)
message_end()
}
// OTHER PUNLIC
public ww(id)
{
for (new id = 1; id <= 32; id++)
{
cmd_fastrun(id)
}
client_print(id, print_chat, "[%s][%s][%i][%i][%i]", zclass_model, zclass_gravity, zclass_speed, zclass_knockback)
}
|
can't find the function key , wanna set it to G , can help ah? 
__________________
Quote:
Originally Posted by addons_zz
Also, just to not read `the article`, read all you find. Read and read, for ever and ever. Never stop reading.
Why? Because there is not one single universal truth which holds the meaning for everything.
|
|
|