|
Author
|
Message
|
|
Junior Member
|

02-11-2010
, 07:17
[Help]Class ZM only for Admins
|
#1
|
How i put this class only for admins?
Thanks.
Quote:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#define PLUGIN "[ZP] Class : Leap Zombie"
#define VERSION "1.4.2"
#define AUTHOR "Fry!"
new const zclass_name[] = "Leap Zombie"
new const zclass_info[] = "HP+ Speed+ Gravity++ Knockback++"
new const zclass_model[] = "zombie_source"
new const zclass_clawmodel[] = "v_knife_zombie.mdl"
const zclass_health = 2200
const zclass_speed = 230
const Float:zclass_gravity = 0.5
const Float:zclass_knockback = 1.7
new bool:g_hasLeap[33]
new g_zclass_Leap, g_Leap_force, g_Leap_height
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("zp_zclass_leap_zombie",VERSION ,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCV AR_SPONLY)
g_Leap_force = register_cvar("zp_zclass_leap_force", "570")
g_Leap_height = register_cvar("zp_zclass_leap_height", "275")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
}
public plugin_precache()
{
g_zclass_Leap = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}
public client_connect(id)
{
g_hasLeap[id] = false
}
public zp_user_infected_post(player, infector)
{
if (zp_get_user_zombie_class(player) == g_zclass_Leap)
g_hasLeap[player] = true
return PLUGIN_CONTINUE
}
public zp_user_humanized_post(player)
{
g_hasLeap[player] = false
}
public fw_PlayerPreThink(id)
{
if (!is_user_alive(id) || !zp_get_user_zombie(id))
return FMRES_IGNORED
if (zp_get_user_zombie_class(id) != g_zclass_Leap)
{
g_hasLeap[id] = false
}
if (allowed_Leap(id))
{
g_hasLeap[id] = true
static Float:velocity[3]
velocity_by_aim(id, get_pcvar_num(g_Leap_force), velocity)
velocity[2] = get_pcvar_float(g_Leap_height)
set_pev(id, pev_velocity, velocity)
}
return FMRES_IGNORED
}
allowed_Leap(id)
{
if (!zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_zclass_Leap)
return false
static buttons
buttons = pev(id, pev_button)
if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 20 || !(buttons & IN_JUMP) || !(buttons & IN_DUCK))
return false
return true
}
stock fm_get_speed(entity)
{
static Float:velocity[3]
pev(entity, pev_velocity, velocity)
return floatround(vector_length(velocity))
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
|
__________________
|
|
|
|