Raised This Month: $ Target: $400
 0% 

Traceline


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 10-12-2005 , 18:09   Traceline
Reply With Quote #1

Ok, I'm trying to use this method instead of using set_user_hitzones because it's supposedly buggy. The problem is whenever I look at someone or whatever, the debug messages and sounds come up and I'm not even firing.
Code:
// My defines #define ARMOR_OFFSET    112     // Armortype offset #define ARMOR_DEFAULT   100.0       // Default amount of armor #define ARMOR_NONE  0 #define ARMOR_NOHELM    1 #define ARMOR_HELM  2 #define HITS_HELM   3 #define HITS_NOHELM 5 // plugin_init register_forward(FM_TraceLine, "forward_traceline", 1); public forward_traceline( Float:v1[3], Float:v2[3], noMonsters, id ) {     if( !is_user_connected(id) || !is_user_alive(id) )         return FMRES_IGNORED;     new iVictim = get_tr(TR_pHit);     if( !is_user_connected(iVictim) || !is_user_alive(iVictim) || is_user_bot(iVictim) )         return FMRES_IGNORED;     new iHitPlace = get_tr(TR_iHitgroup);     new iArmor = get_pdata_int(iVictim, ARMOR_OFFSET);     new szUserName[33];     get_user_name(iVictim, szUserName, 32);     switch( iArmor )     {         case ARMOR_NOHELM:         {             if( g_iHits[iVictim] <= HITS_NOHELM )             {                 emit_sound(iVictim, CHAN_VOICE, "player/bhit_kevlar-1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);                 set_tr(TR_iHitgroup, HIT_GENERIC);                 client_print(iVictim, 4, "[DEBUG] Your kevlar just took a shot, %s", szUserName);             }         }         case ARMOR_HELM:         {             if( g_iHits[iVictim] <= HITS_HELM )             {                 if( iHitPlace == HIT_HEAD )                     emit_sound(iVictim, CHAN_VOICE, "player/bhit_helmet-1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);                 set_tr(TR_iHitgroup, HIT_GENERIC);                 client_print(iVictim, 4, "[DEBUG] Your kevlar/helmet just took a shot, %s", szUserName);             }         }     }     return FMRES_IGNORED; }
Could I do something like this to prevent it?
Code:
if( (get_user_button(id)&IN_ATTACK) && g_iHits[iVictim] <= HITS_NOHELM )
Thanks
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-12-2005 , 18:33  
Reply With Quote #2

Quote:
Originally Posted by v3x
Could I do something like this to prevent it? Small:

if( (get_user_button(id)&IN_ATTACK) && g_iHits[iVictim] <= HITS_NOHELM )


You answered your self


But i would feel better checking it every frame with a bool.

Code:
// etc etc new bool:shouldCheck[33] ... ... public client_PreThink(id) {        if( (get_user_button(id)&IN_ATTACK) ) {                          shouldCheck[id] = true        }          else {                shouldCheck[id] = false               } }


Then just execute the code through one big if statement ^^
[/small]
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 10-12-2005 , 18:43  
Reply With Quote #3

Bah, ok. Now I have to do something with FF

I'll try this
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-12-2005 , 18:49  
Reply With Quote #4

TraceLines happen alot, regardless of whether or not you are firing. Even checking if they are holding the attack button won't work in all situations, because TraceLine is called more often then bullets come out of their gun, and it can be called while the weapon is drawing, holstering, reloading, etcetera.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 10-12-2005 , 18:55  
Reply With Quote #5

[EDITED]
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-12-2005 , 18:55  
Reply With Quote #6

Thats what i was thought ( what avalanche said ) but did not think it was right.


So, what i would do is possibly register The Damage event ?


But by then it would be to late to do what ever your going to do.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 10-12-2005 , 19:34  
Reply With Quote #7

What do you suggest I do? ;\
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-12-2005 , 19:39  
Reply With Quote #8

Try both ways, and see which one works, if any of them
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
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:42.


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