Raised This Month: $ Target: $400
 0% 

knockback power


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kazuki
Senior Member
Join Date: Dec 2008
Old 04-04-2009 , 02:03   knockback power
Reply With Quote #1

Does anyone know what is the code of the knockback ??

PHP Code:
set_pev(playerpev_knockback, (pev(playerpev_knockback,) + get_pcvar_float(pKnockback,))); 
can't
kazuki is offline
Hello-World
Senior Member
Join Date: May 2008
Old 04-04-2009 , 04:53   Re: knockback power
Reply With Quote #2

edit those code in zombie_plague .sma
Quote:
// Knockback Power values for weapons
// Note: negative values will disable knockback power for the weapon
new const Float:kb_weapon_power[] =
{
-1.0, // ---
2.4, // P228
-1.0, // ---
7.5, // SCOUT
-1.0, // ---
9.0, // XM1014
-1.0, // ---
2.3, // MAC10
5.0, // AUG
-1.0, // ---
3.4, // ELITE
2.0, // FIVESEVEN
3.4, // UMP45
6.3, // SG550
5.5, // GALIL
5.5, // FAMAS
2.2, // USP
2.0, // GLOCK18
10.0, // AWP
2.5, // MP5NAVY
5.2, // M249
8.0, // M3
5.0, // M4A1
2.4, // TMP
6.5, // G3SG1
-1.0, // ---
7.3, // DEAGLE
5.0, // SG552
6.0, // AK47
-1.0, // ---
2.0 // P90
}
the number higher - the stronger knockback
__________________
sry for my bad english
I'm helpful !! +karma 4 me
I said something wrong !! Don't -karma
Learnin' scripting and skinning 4 Now !
Mine Comp Got Burned , can't do anything for 3 month
Hello-World is offline
kazuki
Senior Member
Join Date: Dec 2008
Old 04-04-2009 , 06:01   Re: knockback power
Reply With Quote #3

-.- i knows those, i want to set knockback on my extra item..
kazuki is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-04-2009 , 08:26   Re: knockback power
Reply With Quote #4

it's velocity.
You'll need to get velocity by attacker aim and then set this velocity to victim on trace attack forward.
Here is example from ZP:
PHP Code:
Ham Trace Attack Forward
public fw_TraceAttack(victimattackerFloat:damageFloat:direction[3], tracehandledamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_connected(attacker))
        return 
HAM_IGNORED;
    
    
// New round starting or round ended
    
if (g_newround || g_endround)
        return 
HAM_SUPERCEDE;
    
    
// Victim shouldn't take damage or victim is frozen
    
if (g_nodamage[victim] || g_frozen[victim])
        return 
HAM_SUPERCEDE;
    
    
// Prevent friendly fire
    
if (g_zombie[attacker] == g_zombie[victim])
        return 
HAM_SUPERCEDE;
    
    
// Victim isn't a normal zombie
    
if (!g_zombie[victim] || g_nemesis[victim])
        return 
HAM_IGNORED;
    
    
// Get custom hitzones setting
    
static hitzones
    hitzones 
get_pcvar_num(cvar_hitzones)
    
    
// Check if we hit an allowed one
    
if (hitzones && !(hitzones & (1<<get_tr2(tracehandleTR_iHitgroup))))
        return 
HAM_SUPERCEDE;
    
    
// Knockback disabled or not bullet damage
    
if (!(damage_type DMG_BULLET) || !get_pcvar_num(cvar_knockback))
        return 
HAM_IGNORED;
    
    
// Get victim flags and knockback while ducking setting
    
static victimflagsFloat:knockduck
    victimflags 
pev(victimpev_flags)
    
knockduck get_pcvar_float(cvar_knockbackducking)
    
    
// Zombie is ducking on ground
    
if (knockduck == 0.0 && (victimflags FL_DUCKING) && (victimflags FL_ONGROUND))
        return 
HAM_IGNORED;
    
    
// Get distance between players
    
static Float:origin1F[3], Float:origin2F[3]
    
pev(victimpev_originorigin1F)
    
pev(attackerpev_originorigin2F)
    
    
// Max distance exceeded
    
if (get_distance_f(origin1Forigin2F) > get_pcvar_float(cvar_knockbackdist))
        return 
HAM_IGNORED;
    
    
// Get victim's velocity
    
static Float:velocity[3]
    
pev(victimpev_velocityvelocity)
    
    
// Use damage on knockback calculation
    
if (get_pcvar_num(cvar_knockbackdamage))
        
xs_vec_mul_scalar(directiondamagedirection)
    
    
// Use weapon power on knockback calculation
    
if (kb_weapon_power[g_currentweapon[attacker]] > 0.0 && get_pcvar_num(cvar_knockbackpower))
        
xs_vec_mul_scalar(directionkb_weapon_power[g_currentweapon[attacker]], direction)
    
    
// Apply ducking knockback multiplier
    
if ((victimflags FL_DUCKING) && (victimflags FL_ONGROUND))
        
xs_vec_mul_scalar(directionknockduckdirection)
    
    
// Apply zombie class knockback multiplier
    
xs_vec_mul_scalar(directiong_zclass_kb[g_zombieclass[victim]], direction)
    
    
// Add up the new vector
    
xs_vec_add(velocitydirectiondirection)
    
    
// Should knockback also affect vertical velocity?
    
if (!get_pcvar_num(cvar_knockbackzvel))
        
direction[2] = velocity[2]
    
    
// Set the knockback'd victim's velocity
    
set_pev(victimpev_velocitydirection)
    
    return 
HAM_IGNORED;

__________________

SonicSonedit is offline
Anggara_nothing
Veteran Member
Join Date: Jan 2009
Location: Indonesia
Old 04-04-2009 , 09:32   Re: knockback power
Reply With Quote #5

Quote:
Originally Posted by SonicSonedit View Post
it's velocity.
You'll need to get velocity by attacker aim and then set this velocity to victim on trace attack forward.
Here is example from ZP:
PHP Code:
Ham Trace Attack Forward
public fw_TraceAttack(victimattackerFloat:damageFloat:direction[3], tracehandledamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_connected(attacker))
        return 
HAM_IGNORED;
    
    
// New round starting or round ended
    
if (g_newround || g_endround)
        return 
HAM_SUPERCEDE;
    
    
// Victim shouldn't take damage or victim is frozen
    
if (g_nodamage[victim] || g_frozen[victim])
        return 
HAM_SUPERCEDE;
    
    
// Prevent friendly fire
    
if (g_zombie[attacker] == g_zombie[victim])
        return 
HAM_SUPERCEDE;
    
    
// Victim isn't a normal zombie
    
if (!g_zombie[victim] || g_nemesis[victim])
        return 
HAM_IGNORED;
    
    
// Get custom hitzones setting
    
static hitzones
    hitzones 
get_pcvar_num(cvar_hitzones)
    
    
// Check if we hit an allowed one
    
if (hitzones && !(hitzones & (1<<get_tr2(tracehandleTR_iHitgroup))))
        return 
HAM_SUPERCEDE;
    
    
// Knockback disabled or not bullet damage
    
if (!(damage_type DMG_BULLET) || !get_pcvar_num(cvar_knockback))
        return 
HAM_IGNORED;
    
    
// Get victim flags and knockback while ducking setting
    
static victimflagsFloat:knockduck
    victimflags 
pev(victimpev_flags)
    
knockduck get_pcvar_float(cvar_knockbackducking)
    
    
// Zombie is ducking on ground
    
if (knockduck == 0.0 && (victimflags FL_DUCKING) && (victimflags FL_ONGROUND))
        return 
HAM_IGNORED;
    
    
// Get distance between players
    
static Float:origin1F[3], Float:origin2F[3]
    
pev(victimpev_originorigin1F)
    
pev(attackerpev_originorigin2F)
    
    
// Max distance exceeded
    
if (get_distance_f(origin1Forigin2F) > get_pcvar_float(cvar_knockbackdist))
        return 
HAM_IGNORED;
    
    
// Get victim's velocity
    
static Float:velocity[3]
    
pev(victimpev_velocityvelocity)
    
    
// Use damage on knockback calculation
    
if (get_pcvar_num(cvar_knockbackdamage))
        
xs_vec_mul_scalar(directiondamagedirection)
    
    
// Use weapon power on knockback calculation
    
if (kb_weapon_power[g_currentweapon[attacker]] > 0.0 && get_pcvar_num(cvar_knockbackpower))
        
xs_vec_mul_scalar(directionkb_weapon_power[g_currentweapon[attacker]], direction)
    
    
// Apply ducking knockback multiplier
    
if ((victimflags FL_DUCKING) && (victimflags FL_ONGROUND))
        
xs_vec_mul_scalar(directionknockduckdirection)
    
    
// Apply zombie class knockback multiplier
    
xs_vec_mul_scalar(directiong_zclass_kb[g_zombieclass[victim]], direction)
    
    
// Add up the new vector
    
xs_vec_add(velocitydirectiondirection)
    
    
// Should knockback also affect vertical velocity?
    
if (!get_pcvar_num(cvar_knockbackzvel))
        
direction[2] = velocity[2]
    
    
// Set the knockback'd victim's velocity
    
set_pev(victimpev_velocitydirection)
    
    return 
HAM_IGNORED;

He want plugin for weapon has knockback
Anggara_nothing is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 04-04-2009 , 09:45   Re: knockback power
Reply With Quote #6

look at this
http://forums.alliedmods.net/showthread.php?p=119498
__________________
alan_el_more is offline
Shard
Member
Join Date: Mar 2009
Old 04-04-2009 , 12:43   Re: knockback power
Reply With Quote #7

Quote:
Originally Posted by alan_el_more View Post
Isn't this the same as editting the knockback in the zombieplague file?
Shard is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 04-04-2009 , 15:17   Re: knockback power
Reply With Quote #8

No i saw the plugin
sorry
__________________
alan_el_more is offline
kazuki
Senior Member
Join Date: Dec 2008
Old 04-04-2009 , 23:44   Re: knockback power
Reply With Quote #9

-.- you got an wrong idea what i was talking about..

i was talking about the Superzombie extra item with no knockback...
kazuki is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-05-2009 , 08:19   Re: knockback power
Reply With Quote #10

kazuki
I see. Then you'll have to edit Zombie_Plague40.sma knockback function code (above) and add something
PHP Code:
if (user_has_antiknocback_extraitem[id]) retund HAM_IGNORED
__________________

SonicSonedit is offline
Reply



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 19:06.


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