Plug-ins compatibility with Zombie Escape 1.x only!
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#1
Post
by Mark » 5 years ago
Knife Knockback
Description:
- This addon will make your knife have a knockback
Cvars
CvarPower = register_cvar("kb_power","1000")
CvarHeight = register_cvar("kb_height","500")
Code:
#include <zombie_escape>
new g_pCvarPower,
g_pCvarHeight
public plugin_init()
{
register_plugin("ZE Knife Knock Back", "0.0.1", "wbyokomo")
g_pCvarPower = register_cvar("kb_power","1000")
g_pCvarHeight = register_cvar("kb_height","500")
RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
}
public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:flDamage, bitsDamageType)
{
if(iVictim == iAttacker) return HC_CONTINUE; //self damage
if(iInflictor != iAttacker) return HC_CONTINUE; //prevent from other damage like bazooka, tripmine we need knife damage only
if(!is_user_connected(iAttacker)) return HC_CONTINUE; //non-player damage
if(get_user_weapon(iAttacker) != CSW_KNIFE) return HC_CONTINUE; //current weapon is not knife
if(ze_is_user_zombie(iVictim) && !ze_is_user_zombie(iAttacker))
{
static Float:flVelocity[3]
velocity_by_aim(iAttacker, get_pcvar_num(g_pCvarPower), flVelocity)
flVelocity[2] = get_pcvar_float(g_pCvarHeight)
set_entvar(iVictim, var_velocity, flVelocity)
}
return HC_CONTINUE;
}
Have Fun
Last edited by
Mark 5 years ago, edited 3 times in total.
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#2
Post
by Raheem » 5 years ago
ReAPI and My STYLE
:
#include <zombie_escape>
new g_pCvarPower,
g_pCvarHeight
public plugin_init()
{
register_plugin("ZP Knife Knock Back", "0.0.1", "wbyokomo")
g_pCvarPower = register_cvar("kb_power","1000")
g_pCvarHeight = register_cvar("kb_height","500")
RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
}
public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:flDamage, bitsDamageType)
{
if(iVictim == iAttacker) return HC_CONTINUE; //self damage
if(iInflictor != iAttacker) return HC_CONTINUE; //prevent from other damage like bazooka, tripmine we need knife damage only
if(!is_user_connected(iAttacker)) return HC_CONTINUE; //non-player damage
if(get_user_weapon(iAttacker) != CSW_KNIFE) return HC_CONTINUE; //current weapon is not knife
if(ze_is_user_zombie(iVictim) && !ze_is_user_zombie(iAttacker))
{
static Float:flVelocity[3]
velocity_by_aim(iAttacker, get_pcvar_num(g_pCvarPower), flVelocity)
flVelocity[2] = get_pcvar_float(g_pCvarHeight)
set_entvar(iVictim, var_velocity, flVelocity)
}
return HC_CONTINUE;
}
Last edited by
Raheem 5 years ago, edited 1 time in total.
Reason: iInflictor ...
He who fails to plan is planning to fail
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#3
Post
by Mark » 5 years ago
Raheem wrote: ↑5 years ago
ReAPI and My STYLE
:
#include <zombie_escape>
new g_pCvarPower,
g_pCvarHeight
public plugin_init()
{
register_plugin("ZP Knife Knock Back", "0.0.1", "wbyokomo")
g_pCvarPower = register_cvar("kb_power","1000")
g_pCvarHeight = register_cvar("kb_height","500")
RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
}
public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:flDamage, bitsDamageType)
{
if(iVictim == iAttacker) return HC_CONTINUE; //self damage
if(inflictor != iAttacker) return HC_CONTINUE; //prevent from other damage like bazooka, tripmine we need knife damage only
if(!is_user_connected(iAttacker)) return HC_CONTINUE; //non-player damage
if(get_user_weapon(iAttacker) != CSW_KNIFE) return HC_CONTINUE; //current weapon is not knife
if(ze_is_user_zombie(iVictim) && !ze_is_user_zombie(iAttacker))
{
static Float:flVelocity[3]
velocity_by_aim(iAttacker, get_pcvar_num(g_pCvarPower), flVelocity)
flVelocity[2] = get_pcvar_float(g_pCvarHeight)
set_entvar(iVictim, var_velocity, flVelocity)
}
return HC_CONTINUE;
}
Updated first post with your code
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#4
Post
by Raheem » 5 years ago
But try my code first, i don't trust myself
He who fails to plan is planning to fail
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#5
Post
by Mark » 5 years ago
Raheem wrote: ↑5 years ago
But try my code first, i don't trust myself
your code i put mine back for now
//// ze_knife_knockback.sma
//
// C:\Users\marcu\Desktop\Compiler v1.8.3\Compiler v1.8.3\scripting\ze_knife_knockback.sma(19) : error 017: undefined symbol "inflictor"
//
// 1 Error.
// Could not locate output file compiled\ze_knife_knockback.amx (compile failed).
//
// Compilation Time: 0.59 sec
// ----------------------------------------
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#6
Post
by Mark » 5 years ago
Mark wrote: ↑5 years ago
Raheem wrote: ↑5 years ago
But try my code first, i don't trust myself
your code i put mine back for now
//// ze_knife_knockback.sma
//
// C:\Users\marcu\Desktop\Compiler v1.8.3\Compiler v1.8.3\scripting\ze_knife_knockback.sma(19) : error 017: undefined symbol "inflictor"
//
// 1 Error.
// Could not locate output file compiled\ze_knife_knockback.amx (compile failed).
//
// Compilation Time: 0.59 sec
// ----------------------------------------
i fixed your typo
#include <zombie_escape>
new g_pCvarPower,
g_pCvarHeight
public plugin_init()
{
register_plugin("ZP Knife Knock Back", "0.0.1", "wbyokomo")
g_pCvarPower = register_cvar("kb_power","1000")
g_pCvarHeight = register_cvar("kb_height","500")
RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
}
public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:flDamage, bitsDamageType)
{
if(iVictim == iAttacker) return HC_CONTINUE; //self damage
if(iInflictor != iAttacker) return HC_CONTINUE; //prevent from other damage like bazooka, tripmine we need knife damage only
if(!is_user_connected(iAttacker)) return HC_CONTINUE; //non-player damage
if(get_user_weapon(iAttacker) != CSW_KNIFE) return HC_CONTINUE; //current weapon is not knife
if(ze_is_user_zombie(iVictim) && !ze_is_user_zombie(iAttacker))
{
static Float:flVelocity[3]
velocity_by_aim(iAttacker, get_pcvar_num(g_pCvarPower), flVelocity)
flVelocity[2] = get_pcvar_float(g_pCvarHeight)
set_entvar(iVictim, var_velocity, flVelocity)
}
return HC_CONTINUE;
}
Your code works fine!
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#7
Post
by Raheem » 5 years ago
OH, I updated it. Just confirm it's working in server.
Edit: That's OK
Last edited by
Raheem 5 years ago, edited 1 time in total.
Reason: OK
He who fails to plan is planning to fail
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#8
Post
by Mark » 5 years ago
Raheem wrote: ↑5 years ago
OH, I updated it. Just confirm it's working in server.
Edit: That's OK
maybe we clean this thread up lol
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#9
Post
by Raheem » 5 years ago
lol, let comments maybe someone find something useful in them
He who fails to plan is planning to fail
-
Rain1153
- Senior Member
- Posts: 278
- Joined: 6 years ago
-
Contact:
-
Quote
-
0
login to like this post
#10
Post
by Rain1153 » 5 years ago
I thought when zombie would hit humans the human will fly away
LOL
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#11
Post
by Mark » 5 years ago
-
Mark
- VIP
- Posts: 283
- Joined: 5 years ago
- Location: Des Moines/USA
-
Contact:
-
Quote
-
0
login to like this post
#12
Post
by Mark » 5 years ago
Rain1153 wrote: ↑5 years ago
I thought when zombie would hit humans the human will fly away
If you want that to happen i could make that happen lol
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Register
Sign in
Users browsing this forum: No registered users and 0 guests