Raised This Month: $ Target: $400
 0% 

vector beam problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Swear
Junior Member
Join Date: May 2009
Location: Latvia
Old 07-31-2010 , 16:39   vector beam problem
Reply With Quote #1

Hello! I found some snippets on this board and i'm trying to make plugin that shows players aiming vector beam. it works but there's problem. when i'm fast moving mouse beams split up. old beams doesn't hide fast enought. image explaining it:
[IMG]http://img34.**************/img34/4726/bugdj.png[/IMG]

here's the code
Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <xs>

new sprite;

public plugin_init()
{
    register_plugin("Laser Beam", "1.0", "stupok")
    
    register_forward(FM_PlayerPreThink, "fw_playerprethink")
}

public plugin_precache()
{
    sprite = precache_model("sprites/laserbeam.spr");
}

public fw_playerprethink(id)
{
    show_beam2(id)
}


public show_beam2(id)
{
    static Float:fStart[3], Float:fEnd[3];
    static tr;
    
    // This block is interchangeable with get_user_origin(id,origin,3)
    pev(id, pev_origin, fStart)
    
    pev(id, pev_v_angle, fEnd)
    engfunc(EngFunc_MakeVectors, fEnd)
    global_get(glb_v_forward, fEnd)
    xs_vec_mul_scalar(fEnd, 9999.0, fEnd)
    xs_vec_add(fStart, fEnd, fEnd)
    
    tr = create_tr2()
    engfunc(EngFunc_TraceLine, fStart, fEnd, DONT_IGNORE_MONSTERS, id, tr)
    get_tr2(tr, TR_vecEndPos, fEnd)
    free_tr2(tr)
    //
    
    //get_user_origin(id,origin,3); // 3 - End position from eyes (hit point for weapon)
    
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(1);
    write_short(id | 0x1000); // start entity
    engfunc(EngFunc_WriteCoord, fEnd[0])
    engfunc(EngFunc_WriteCoord, fEnd[1])
    engfunc(EngFunc_WriteCoord, fEnd[2])
    //write_coord(origin[0]); // endposition.x
    //write_coord(origin[1]); // endposition.y
    //write_coord(origin[2]); // endposition.z
    write_short(sprite); // sprite index
    write_byte(0); // starting frame
    write_byte(0); // frame rate in 0.1's
    write_byte(1); // life in 0.1's
    write_byte(10); // line wdith in 0.1's
    write_byte(0); // noise amplitude in 0.01's
    write_byte(0); // red
    write_byte(0); // green
    write_byte(255); // blue
    write_byte(255); // brightness
    write_byte(255); // scroll speed in 0.1's
    message_end();

    return PLUGIN_HANDLED;
}
sorry for my bad english.
Swear is offline
Send a message via Skype™ to Swear
 



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 00:06.


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