Raised This Month: $ Target: $400
 0% 

Bullet 'tracer'


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DahVid
Senior Member
Join Date: Jun 2005
Old 08-21-2005 , 18:29   Bullet 'tracer'
Reply With Quote #1

I'm wondering how to create an entity to 'follow' a bullet. I looked at the tracer plugins but I didn't really figure it out. I didnt even see a create_entity or anything!
DahVid is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-21-2005 , 18:34  
Reply With Quote #2

Code:
#define	TE_TRACER			6		// tracer effect from point to point
// coord, coord, coord (start) 
// coord, coord, coord (end)
This is a temp entity (that's what TE stands for). So, just figure out when they fire, use get_user_origin with different paramaters to get starting and ending point, and send the message.

Code:
message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(6); // TE_TRACER write_coord(start[0]); write_coord(start[1]); write_coord(start[2]); write_coord(end[0]); write_coord(end[1]); write_coord(end[2]); message_end();
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
DahVid
Senior Member
Join Date: Jun 2005
Old 08-21-2005 , 19:47  
Reply With Quote #3

Do like this?
Code:
new origin[3]

get_user_origin(id,origin,1)

message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(6); // TE_TRACER
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]);
write_coord(end[0]);
write_coord(end[1]);
write_coord(end[2]);
message_end();
If that is it, I will try to figure out how to find the ending (get_user_aiming or something probably)

And for shotgun, would I make it

Code:
#define TE_MULTIGUNSHOT            126 // much more compact shotgun message
// This message is used to make a client approximate a 'spray' of gunfire.
// Any weapon that fires more than one bullet per frame and fires in a bit of a spread is
// a good candidate for MULTIGUNSHOT use. (shotguns)
//
// NOTE: This effect makes the client do traces for each bullet, these client traces ignore
//       entities that have studio models.Traces are 4096 long.
//
// coord (origin)
// coord (origin)
// coord (origin)
// coord (direction)
// coord (direction)
// coord (direction)
// coord (x noise * 100)
// coord (y noise * 100)
// byte (count)
// byte (bullethole decal texture index)
The only way I would know how to figure out if shooting is see if user is on mouse1.. That wouldn't be right. Only fire one bullet!

Also -- How would I figure if that entity is there, like hook on the 'trail?'

Sorry, Like I said I am noob, hard for me to figure this stuff out!
DahVid is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 08-21-2005 , 20:00  
Reply With Quote #4

To get the ending point ( where the bullet will hit ):
Code:
get_user_origin(id,origin,3)
__________________
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 08-21-2005 , 21:46  
Reply With Quote #5

Yes, you need to get the ending origin, and you can do it like v3x posted.

From that code it looks like TE_MULTIGUNSHOT will do some tracer action, and it will also create the bullet holes in the wall.

This is xeroblood's method of determining when a shot is fired:

Code:
#define MAX_PLAYERS 32 // Tracks players Shots-Fired: [0]=WeaponID, [1]=Ammo new g_nCurWeapon[MAX_PLAYERS][2] public plugin_init() {     register_event( "CurWeapon", "Event_ShotFired",  "b" ) } public Event_ShotFired( id ) {     // Players current weapon data..     new weaponID = read_data( 2 )     new wAmmo = read_data( 3 )     if( g_nCurWeapon[id-1][0] != weaponID ) // User Changed Weapons..     {         g_nCurWeapon[id-1][0] = weaponID         g_nCurWeapon[id-1][1] = wAmmo         return PLUGIN_CONTINUE     }     if( g_nCurWeapon[id-1][1] < wAmmo ) // User Reloaded..     {         g_nCurWeapon[id-1][1] = wAmmo         return PLUGIN_CONTINUE     }     if( g_nCurWeapon[id-1][1] == wAmmo ) // User did something else, but didn't shoot..         return PLUGIN_CONTINUE         // This far means user shot his/her gun..     // Save new weapon data..     g_nCurWeapon[id-1][1] = wAmmo     g_nCurWeapon[id-1][0] = weaponID     // Now you can do stuff, like:     // Get the origin of weapon hit-point     new nPoint[3]     get_user_origin( id, nPoint, 3 )     // blah blah blah...     return PLUGIN_CONTINUE }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
DahVid
Senior Member
Join Date: Jun 2005
Old 08-21-2005 , 22:14  
Reply With Quote #6

Yes, I've already made it with a function that triggers on CurWeapon.. I think I will add a check like Xero's so it doesn't put a tracer on all currweap events..
DahVid 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 09:36.


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