Raised This Month: $ Target: $400
 0% 

Brass Knuckles adding "kick"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 07-11-2006 , 02:29   Brass Knuckles adding "kick"
Reply With Quote #1

Hey guys just wondering if you could tell me why the plugin below isnt 'kicking' the person that gets hit with them..like its suposed to be like a real punch.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>

new PLUGIN_NAME[] =    "Brass Knuckles"
new PLUGIN_VERSION[] =     "1.0"
new PLUGIN_AUTHOR[] =    "Cheap_Suit"

new bool:g_bknuckles[33]
public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
register_event("Damage""Event_Damage""be""2!0")
    
register_event("DeathMsg""Event_Death""a")
    
register_forward(FM_EmitSound"EmitSound")
}

public 
plugin_precache()
{
    
precache_model("models/p_bknuckles.mdl")
    
precache_model("models/v_bknuckles.mdl")
    
precache_sound("bknuckles/knife_hit1.wav")
    
precache_sound("bknuckles/knife_hit2.wav")
    
precache_sound("bknuckles/knife_hit3.wav")
    
precache_sound("bknuckles/knife_hit4.wav")
    
precache_sound("bknuckles/knife_stab.wav")
}

public 
client_connect(idg_bknuckles[id] = false
public Event_Death() g_bknuckles[read_data(2)] = false

public Event_Damage(id)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
PLUGIN_CONTINUE

    
new AttakerWeaponAttakerPartHit
    
new Attacker get_user_attacker(idAttakerWeaponAttakerPartHit)

    if(
AttakerWeapon != CSW_KNIFE)
        return 
PLUGIN_CONTINUE

    
if(!g_bknuckles[Attacker])
        return 
PLUGIN_CONTINUE

    
new Float:Random_Float[3]
    for(new 
03i++) Random_Float[i] = random_float(100.0150.0)
    
Punch_View(idRandom_Float)

    return 
PLUGIN_CONTINUE
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
PLUGIN_CONTINUE

    
new temp[2], weapon get_user_weapon(idtemp[0], temp[1])
    if(
weapon == CSW_KNIFE)
    {
        
entity_set_string(idEV_SZ_viewmodel"models/v_bknuckles.mdl")
        
entity_set_string(idEV_SZ_weaponmodel"models/p_bknuckles.mdl")
    }
    return 
PLUGIN_CONTINUE
}

public 
EmitSound(idchannelsample[])
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
FMRES_IGNORED

    
new temp[2], weapon get_user_weapon(idtemp[0], temp[1])
    if(
weapon == CSW_KNIFE)
    {
        if(
g_bknuckles[id])
        {
            if(
equal(sample,"weapons/knife_hit1.wav"))
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_hit1.wav"1.0ATTN_NORM0PITCH_NORM)
                return 
FMRES_SUPERCEDE
            
}
            else if(
equal(sample,"weapons/knife_hit2.wav"))
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_hit2.wav"1.0ATTN_NORM0PITCH_NORM)
                return 
FMRES_SUPERCEDE
            
}
            else if(
equal(sample,"weapons/knife_hit3.wav"))
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_hit3.wav"1.0ATTN_NORM0PITCH_NORM)
                return 
FMRES_SUPERCEDE
            
}
            else if(
equal(sample,"weapons/knife_hit4.wav"))
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_hit4.wav"1.0ATTN_NORM0PITCH_NORM)
                return 
FMRES_SUPERCEDE
            
}
            else if(
equal(sample,"weapons/knife_stab.wav"))
            {
                
emit_sound(idCHAN_WEAPON"bknuckles/knife_stab.wav"1.0ATTN_NORM0PITCH_NORM)
                return 
FMRES_SUPERCEDE
            
}
        }
    }
    return 
FMRES_IGNORED
}

stock Punch_View(idFloat:ViewAngle[3])
{
    
entity_set_vector(idEV_VEC_punchangleViewAngle)

SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-11-2006 , 02:59   Re: Brass Knuckles adding "kick"
Reply With Quote #2

Okay. What do you change?
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 07-11-2006 , 14:56   Re: Brass Knuckles adding "kick"
Reply With Quote #3

Where is g_bknuckles being set to true? This is most likely your problem.

Also, 100 to 150 might be more punch than you imagine. Let me know. ;)
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 07-11-2006 , 15:45   Re: Brass Knuckles adding "kick"
Reply With Quote #4

I enabled bknuckles all the time so u dont have to buy it.

and it doesnt 'kick' at all...I want help making it do that.
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-11-2006 , 19:10   Re: Brass Knuckles adding "kick"
Reply With Quote #5

Hmmmm....

Heres an updated version of the plugin.
Attached Files
File Type: sma Get Plugin or Get Source (Brass_Knuckles.sma - 603 views - 4.6 KB)
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 07-12-2006 , 00:45   Re: Brass Knuckles adding "kick"
Reply With Quote #6

Quote:
Originally Posted by SweatyBanana
I enabled bknuckles all the time so u dont have to buy it.
Where is this in the code?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 07-12-2006 , 01:44   Re: Brass Knuckles adding "kick"
Reply With Quote #7

Quote:
Originally Posted by XxAvalanchexX
Where is this in the code?
PHP Code:
    if(weapon == CSW_KNIFE)
    {
        
entity_set_string(idEV_SZ_viewmodel"models/v_bknuckles.mdl")
        
entity_set_string(idEV_SZ_weaponmodel"models/p_bknuckles.mdl")
    } 
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-12-2006 , 02:23   Re: Brass Knuckles adding "kick"
Reply With Quote #8

try this

Code:
public client_connect(id) g_bknuckles[id] = true
and remove

Code:
public Event_Death() g_bknuckles[read_data(2)] = false
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit 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 08:04.


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