Hello, okay so in TFC you have a rocket launcher that serves as the aim origin for the rocket, but this is off-center. It kind of diagonally aims the rocket into your crosshair's destination.
I wish to capture a rocket launch event, get the rocket, and re-fire it dead center of the player's aim. I want quake 3 style rockets basically.
Some code snippets to jog the memory:
Quote:
public PlayerPreThink(id)
{
// Apply this to all living human players
if( is_user_alive(id) && !is_user_bot(id) )
{
// See if a player is attacking
static button;
button = pev(id, pev_button);
if ((RocketDelay[id] == 0) && (button & IN_ATTACK) && (LaglessRocketsEnabled[id] == 1))
{
// If he is, see if he's carrying a rocket launcher
new wpnent1 = find_ent_by_owner(-1, "tf_weapon_rpg", id);
if (wpnent1 > 0)// && (LaglessRocketsEnabled[id] == 1))
{
// If he is, find entities within 50 units of the weapon origin
new Float:wpnorig[3];
pev(wpnent1, pev_origin, wpnorig)
new tent = 0;
while((tent = engfunc(EngFunc_FindEntityInSphere, tent, wpnorig, 50.0)))
{
// Check the found entities for RPG rockets
new sztargetname[31];
pev(tent, pev_classname, sztargetname, 31);
if (equal(sztargetname, tf_rpg_rocket))
{
// Determine that a found rocket was fired by the player
new rocketowner = pev(tent, pev_owner);
if (id == rocketowner)
{ //do stuff with rocket here...}}}}}}}
|