Raised This Month: $7 Target: $400
 1% 

[ H3LP ] Knife ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-29-2017 , 22: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
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-30-2017 , 04:43   Re: [ H3LP ] Knife ?
Reply With Quote #2

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

https://github.com/s1lentq/ReGameDLL...lls/wpn_shared
__________________
retired chump
DjSoftero is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-31-2017 , 15: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
Old 10-31-2017, 18:25
CrazY.
This message has been deleted by CrazY..
DeMNiX
Veteran Member
Join Date: Nov 2011
Location: Russia
Old 11-01-2017 , 01: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
__________________
My channel with test codes
https://www.youtube.com/user/demnix03

Zombie Riot [Scenario & bots-zombie 11.11.2023]
https://youtu.be/8ZZan-aq2sc
DeMNiX is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-01-2017 , 08: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
Old 11-02-2017, 06:42
DeMNiX
This message has been deleted by DeMNiX. Reason: ...
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-02-2017 , 10:03   Re: [ H3LP ] Knife ?
Reply With Quote #7

Thank you @PRoSToTeM@.

https://forums.alliedmods.net/showpo...83&postcount=9
__________________








CrazY. is offline
Old 11-02-2017, 10: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 23:36.


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