Raised This Month: $ Target: $400
 0% 

Wall hit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-03-2014 , 08:46   Re: Wall hit
Reply With Quote #1

Because the second check is wrong. The index should be 'victim' instead of 'attacker', because you should be dead when attacking (dafuq?!), so it will work.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Porta0123
Member
Join Date: Apr 2014
Location: Spain
Old 07-03-2014 , 09:06   Re: Wall hit
Reply With Quote #2

EDIT:

This works (when the player take damage trought a wall will show this hud)

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <engine> #include <xs> public plugin_init() {     RegisterHam(Ham_TraceAttack, "player", "Ham_TraceAttack_pre", 0) } public Ham_TraceAttack_pre(victim, attacker, Float:damage, Float:direction[3], tracehandle, damagebits) {     static Float:vStart[ 3 ], Float:vEnd[ 3 ], Float:flFraction;               get_tr2( tracehandle, TR_vecEndPos, vEnd );     get_tr2( tracehandle, TR_flFraction, flFraction );             xs_vec_mul_scalar( direction, -1.0, direction );     xs_vec_mul_scalar( direction, flFraction * 9999.0, vStart );     xs_vec_add( vStart, vEnd, vStart );               new iTarget = trace_line( victim, vEnd, vStart, vEnd );     if(!iTarget)     {         new msg[53]     new nameV[33]     new nameA[33]     get_user_name(victim,nameV,sizeof nameV-1)     get_user_name(attacker,nameA,sizeof nameA-1)     format(msg,sizeof msg-1,"%s disparo a %s atravesando",nameA,nameV)     set_hudmessage(255, 0, 0, -1.0, 0.01)     show_hudmessage(0, msg)     }     return HAM_IGNORED; }

Last edited by Porta0123; 07-03-2014 at 09:32.
Porta0123 is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 07-03-2014 , 10:13   Re: Wall hit
Reply With Quote #3

Sorry, misstyped that check, now should be fine.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Porta0123
Member
Join Date: Apr 2014
Location: Spain
Old 07-03-2014 , 10:21   Re: Wall hit
Reply With Quote #4

ok, now tested , works(but it show the message every time than the player gets damage trought a wall)

Quote:
Originally Posted by Porta0123 View Post
EDIT:

This works (when the player take damage trought a wall will show this hud)

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <engine> #include <xs> public plugin_init() {     RegisterHam(Ham_TraceAttack, "player", "Ham_TraceAttack_pre", 0) } public Ham_TraceAttack_pre(victim, attacker, Float:damage, Float:direction[3], tracehandle, damagebits) {     static Float:vStart[ 3 ], Float:vEnd[ 3 ], Float:flFraction;               get_tr2( tracehandle, TR_vecEndPos, vEnd );     get_tr2( tracehandle, TR_flFraction, flFraction );             xs_vec_mul_scalar( direction, -1.0, direction );     xs_vec_mul_scalar( direction, flFraction * 9999.0, vStart );     xs_vec_add( vStart, vEnd, vStart );               new iTarget = trace_line( victim, vEnd, vStart, vEnd );     if(!iTarget)     {         new msg[53]     new nameV[33]     new nameA[33]     get_user_name(victim,nameV,sizeof nameV-1)     get_user_name(attacker,nameA,sizeof nameA-1)     format(msg,sizeof msg-1,"%s disparo a %s atravesando",nameA,nameV)     set_hudmessage(255, 0, 0, -1.0, 0.01)     show_hudmessage(0, msg)     }     return HAM_IGNORED; }
Fonts:
-GuskiS
-https://forums.alliedmods.net/showthread.php?t=243217&page=2 (This)
and etc xd
Porta0123 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-03-2014 , 19:56   Re: Wall hit
Reply With Quote #5

Quote:
Originally Posted by Porta0123 View Post
ok, now tested , works(but it show the message every time than the player gets damage trought a wall)


Fonts:
-GuskiS
-https://forums.alliedmods.net/showthread.php?t=243217&page=2 (This)
and etc xd
You know it would have been much easier to link to the post where you found the code rather than change all the variable names and repost it ...
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Porta0123
Member
Join Date: Apr 2014
Location: Spain
Old 07-04-2014 , 09:31   Re: Wall hit
Reply With Quote #6

the code of this page dont works, i change with GuskiS code , and now works

you can test, the code of the page , and the new and tell me what of the 2 works
Porta0123 is offline
xPossible
Junior Member
Join Date: Jul 2014
Old 07-07-2014 , 14:08   Re: Wall hit
Reply With Quote #7

Nope, i don't need check trought a wall.. Okay look.. Maybe now somebody understand me.. I want to print message when PLAYER DO DAMAGE TO MAP (GROUND, DOOR, WINDOWS, WALL) But NOT to player!!!
xPossible is offline
Porta0123
Member
Join Date: Apr 2014
Location: Spain
Old 07-07-2014 , 14:34   Re: Wall hit
Reply With Quote #8

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> public plugin_init() {     register_forward(FM_TraceLine, "traceline_forward"); } public traceline_forward(Float:start[3], Float:end[3], conditions, id, trace) {     if(!is_user_alive(id)) //is alive     return FMRES_IGNORED;     if(!(pev(id,pev_button) & IN_ATTACK)) //is shooting     return FMRES_IGNORED;         if(get_tr2(trace, TR_pHit) == 0)//the traceline hits a wall, if 0 dont works try with -1     {         //here     }     return FMRES_IGNORED; }

Last edited by Porta0123; 07-07-2014 at 14:39.
Porta0123 is offline
xPossible
Junior Member
Join Date: Jul 2014
Old 07-07-2014 , 17:30   Re: Wall hit
Reply With Quote #9

Quote:
Originally Posted by Porta0123 View Post
Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> public plugin_init() {     register_forward(FM_TraceLine, "traceline_forward"); } public traceline_forward(Float:start[3], Float:end[3], conditions, id, trace) {     if(!is_user_alive(id)) //is alive     return FMRES_IGNORED;     if(!(pev(id,pev_button) & IN_ATTACK)) //is shooting     return FMRES_IGNORED;         if(get_tr2(trace, TR_pHit) == 0)//the traceline hits a wall, if 0 dont works try with -1     {         //here     }     return FMRES_IGNORED; }
With -1 work, but not like i need With this code, constantly do conditions when you hold mouse button. Should be one time on press. But how?
xPossible 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 21:11.


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