Raised This Month: $64 Target: $400
 16% 

[ H3LP ] Knife ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: Brazil [<o>]
Old 10-29-2017 , 23:42   [ H3LP ] Knife ?
Reply With Quote #1

Hello, does anyone have the .cpp of knife? I need to understand how the sounds are emitted, as the damage is inflicted... Anyway, all the functionality of the knife.
CrazY. is offline
Send a message via Skype™ to CrazY.
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-30-2017 , 05:43   Re: [ H3LP ] Knife ?
Reply With Quote #2

Look on regamedll: wpn_knife.cpp
__________________
HamletEagle is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Old 10-31-2017 , 15:13   Re: [ H3LP ] Knife ?
Reply With Quote #3

https://github.com/s1lentq/ReGameDLL...lls/wpn_shared
__________________
DjSoftero is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: Brazil [<o>]
Old 10-31-2017 , 16:32   Re: [ H3LP ] Knife ?
Reply With Quote #4

Good, what I tried to do was:

Code:
public task_primary_attack(data[]) {     new attacker = data[0], inflictor = data[1]     new Float:angles[3], Float:start[3], Float:end[3], Float:dir[3], Float:fakeend[3]     new Float:flFraction, pHit     new tr = create_tr2()     get_entvar(attacker, var_angles, angles)     angle_vector(angles, ANGLEVECTOR_FORWARD, dir)     xs_vec_mul_scalar(dir, 80.0, fakeend)     get_entvar(attacker, var_origin, start)     get_entvar(attacker, var_view_ofs, end)     xs_vec_add(end, start, start)     xs_vec_add(start, fakeend, end)     engfunc(EngFunc_TraceLine, start, end, DONT_IGNORE_MONSTERS, attacker, tr)     get_tr2(tr, TR_flFraction, flFraction)     if (flFraction >= 1.0)     {         emit_sound(attacker, CHAN_WEAPON, sound_combistick_slash[random_num(0, sizeof sound_combistick_slash - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_LOW)     }     else     {         pHit = get_tr2(tr, TR_pHit)         if (pHit == -1)         {             pHit = 0             set_tr2(tr, TR_pHit, pHit)         }         rg_multidmg_clear()         ExecuteHamB(Ham_TraceAttack, pHit, attacker, 35.0, dir, tr, DMG_NEVERGIB | DMG_BULLET)         rg_multidmg_apply(inflictor, attacker)         if (pHit && is_user_alive(pHit))             emit_sound(attacker, CHAN_WEAPON, sound_combistick_hit[random_num(0, sizeof sound_combistick_hit - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)         else             emit_sound(attacker, CHAN_WEAPON, sound_combistick_hit_wall, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)     }     free_tr2(tr) }

However, my code is with the following problems:

- when I attack the player, no matter what part of the body, it is always inflicted damage to the head rather than the affected area.

- when I attack a box (in the Cs_assault, a blue box, for example) or the floor, the sound "hit_wall" is not emitted, instead, the "slash" is being emitted.

- in some entities, the damage is only inflicted if I really pull it over, and if I'm crouching at the same time.

Were these the problems I could identify, any idea?
CrazY. is offline
Send a message via Skype™ to CrazY.
Old 10-31-2017, 19:25
CrazY.
This message has been deleted by CrazY..
DeMNiX
Senior Member
Join Date: Nov 2011
Location: Russia
Old 11-01-2017 , 02:16   Re: [ H3LP ] Knife ?
Reply With Quote #5

Quote:
when I attack the player, no matter what part of the body, it is always inflicted damage to the head rather than the affected area.
check your hitboxes of the model
__________________
HI, YouTube!
AMXX/MS3D
DeMNiX is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: Brazil [<o>]
Old 11-01-2017 , 09:27   Re: [ H3LP ] Knife ?
Reply With Quote #6

The problem is not in the model, because I tested with the other weapons, including the knife itself, and presented no problem.
CrazY. is offline
Send a message via Skype™ to CrazY.
Old 11-02-2017, 07:42
DeMNiX
This message has been deleted by DeMNiX. Reason: ...
CrazY.
Veteran Member
Join Date: May 2015
Location: Brazil [<o>]
Old 11-02-2017 , 11:03   Re: [ H3LP ] Knife ?
Reply With Quote #7

Thank you @[email protected].

https://forums.alliedmods.net/showpo...83&postcount=9
CrazY. is offline
Send a message via Skype™ to CrazY.
Old 11-02-2017, 11:04
CrazY.
This message has been deleted by CrazY..
Reply


Thread Tools
Display Modes

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 09:12.


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