|
Author
|
Message
|
|
Senior Member
|

01-07-2016
, 15:56
[EASY] How to make something for admin only
|
#1
|
can you make this for admin only? thanks!
Spoiler
Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
//Uncomment USE_ZP_V50 if you are using ZP50 and above.
//#define USE_ZP_V50
#if defined USE_ZP_V50
native zp_core_is_zombie(id)
#else
native zp_get_user_zombie(id)
#endif
new CvarPower, CvarHeight
public plugin_init()
{
register_plugin("ZP Knife Knock Back", "0.0.1", "wbyokomo")
CvarPower = register_cvar("kb_power","1000")
CvarHeight = register_cvar("kb_height","500")
RegisterHam(Ham_TakeDamage, "player", "OnTakeDamagePost", 1)
}
//a forward from CSBot_Init API
public CSBot_Init(id)
{
RegisterHamFromEntity(Ham_TakeDamage, id, "OnTakeDamagePost", 1)
}
public OnTakeDamagePost(victim, inflictor, attacker/*, Float:damage, dmgtype*/)
{
if(victim == attacker) return HAM_IGNORED; //self damage
if(inflictor != attacker) return HAM_IGNORED; //prevent from other damage like bazooka, tripmine we need knife damage only
if(!is_user_connected(attacker)) return HAM_IGNORED; //non-player damage
if(get_user_weapon(attacker) != CSW_KNIFE) return HAM_IGNORED; //current weapon is not knife
#if defined USE_ZP_V50
if(zp_core_is_zombie(victim) && !zp_core_is_zombie(attacker))
#else
if(zp_get_user_zombie(victim) && !zp_get_user_zombie(attacker))
#endif
{
static Float:fVelocity[3]
velocity_by_aim(attacker, get_pcvar_num(CvarPower), fVelocity)
fVelocity[2] = get_pcvar_float(CvarHeight)
set_pev(victim, pev_velocity, fVelocity)
}
return HAM_IGNORED;
}
Last edited by New and Clueless; 01-07-2016 at 15:58.
|
|
|
|