Raised This Month: $51 Target: $400
 12% 

TE_BEAMPOINTS , beam bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 07-15-2009 , 03:23   TE_BEAMPOINTS , beam bug
Reply With Quote #1

Look at the image and code, lol when I kill enemy sometimes beam appears on the place when player died or on spawn, idk why... Please check the code what is wrong.
P.S. I've tryied also TE_KILLBEAM,seems not working...

PHP Code:
public act_plant(id)
{
    new 
ent g_claymores[id] = create_entity("func_wall");
    
    if (!
pev_valid(ent))
        return;
    
    
g_user_has_cm[id] = 0
    
    engfunc
(EngFunc_SetModelentg_w_claymore);
    
engfunc(EngFunc_SetSizeentFloat:{-4.0, -4.00.0}, Float:{4.04.014.0});
    
set_pev(entpev_classname"Claymore");
    
set_pev(entpev_ownerid);
    
set_pev(entpev_solid2);
    
set_pev(entpev_movetype6);
    
set_pev(entpev_gravity1.3);
    
set_pev(entpev_friction1.0);
    
set_pev(entpev_health30.0);
    
set_pev(entpev_takedamageDAMAGE_YES);
    
    
emit_sound(idCHAN_AUTOg_claymore_plant1.0ATTN_NORM0PITCH_NORM);

    new 
Float:angles[3], Float:origin[3], Float:fov;
    
pev(idpev_v_angleangles);
    
pev(idpev_originorigin);
    
angles[0] = 0.0;
    
origin[0] += floatcos(angles[1], degrees) * 11.0;
    
origin[1] += floatsin(angles[1], degrees) * 11.0;
    
origin[2] -= 10.0;
    
set_pev(entpev_originorigin);
    
set_pev(entpev_anglesangles);
    
set_pev(entpev_v_angleangles);
    
set_pev(entpev_velocityFloat:{0.00.0, -10.0});
    
pev(idpev_fovfov);
    
set_pev(entpev_fovfov);
    
act_beams(ent)

    new 
model[33];
    
pev(idpev_viewmodel2model32);
    if (
equali(modelg_v_claymore))
    {
        
engclient_cmd(id"weapon_knife");
        
set_pev(idpev_weaponmodel2"models/p_knife.mdl");
        
set_pev(idpev_viewmodel2"models/v_knife.mdl");
    }
}
public 
act_beams(ent)
{
    
// make sure its a valid entity
    
if (!pev_valid(ent))
        return;

    if (
pev(entpev_flags) & FL_ONGROUND)
    {
        
// draw the first beam
        
draw_beam(ent30.0);
        
// wait .1 sec and draw the 2nd beam so its easier on the svc    
        
set_task(0.1"draw_beam2"ent TASK_DRAW2)

        
// wait 5 secs then redraw the beams as they only last 5 secs
        
set_task(5.0"act_beams"ent);
    }
    else
        
set_task(0.2"act_beams"ent);
}
// need to use this due to set_task only allowing 1 paramiter to be set
public draw_beam2(ent)
{
    
draw_beam(ent TASK_DRAW2, -30.0)
}
public 
draw_beam(entFloat:angle)
{
    if (!
pev_valid(ent))
        return;
    
    
// gets start and end origins for beam
    
new Float:angles[3], Float:origin[3], Float:origin2[3], user_team get_user_team(pev(entpev_owner));
    
pev(entpev_v_angleangles);
    
pev(entpev_originorigin);
    
origin2[0] = origin[0] + (floatcos(angles[1] + angledegrees) * 38.0);
    
origin2[1] = origin[1] + (floatsin(angles[1] + angledegrees) * 38.0);
    
origin[2] += 12.0;

    
// draws beam
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMPOINTS);        // 0
    
write_coord(floatround(origin[0]));    //centerpoint
    
write_coord(floatround(origin[1]));    //left top corner
    
write_coord(floatround(origin[2]));    //horizontal height
    
write_coord(floatround(origin2[0]));//centerpoint
    
write_coord(floatround(origin2[1]));//left right corner
    
write_coord(floatround(origin[2]));    //horizontal height
    
write_short(beamspr);    //sprite to use
    
write_byte(1);        // framestart
    
write_byte(1);        // framerate
    
write_byte(52);        // life in 0.1's
    
write_byte(3);        // width
    
write_byte(0);        // noise
    
write_byte((user_team == 1) ? 255 0);    // red
    
write_byte(0);                    // green
    
write_byte((user_team == 1) ? 255);    // blue
    
write_byte(200);        // brightness
    
write_byte(0);        // speed
    
message_end();

Attached Thumbnails
Click image for larger version

Name:	beam.jpg
Views:	367
Size:	59.1 KB
ID:	45473  

Last edited by xbatista; 07-15-2009 at 03:25.
xbatista is offline
Send a message via Skype™ to xbatista
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 07-15-2009 , 14:09   Re: TE_BEAMPOINTS , beam bug
Reply With Quote #2

Help please :}
xbatista is offline
Send a message via Skype™ to xbatista
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 07-15-2009 , 15:12   Re: TE_BEAMPOINTS , beam bug
Reply With Quote #3

i dont understand what the problem is?
are you trying to create beampoints when a player dies?
__________________
minimiller is offline
Send a message via MSN to minimiller
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 07-15-2009 , 17:38   Re: TE_BEAMPOINTS , beam bug
Reply With Quote #4

No, look at the code, i'm creating beam on entity and sometimes i don't know why,it creates beam on died player origin or creates every 5seconds on spawned player origin, I'm using nothing on spawn and death events what asociates with beam or ents
xbatista is offline
Send a message via Skype™ to xbatista
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 07-15-2009 , 17:43   Re: TE_BEAMPOINTS , beam bug
Reply With Quote #5

when are you calling act_plant and act_beams?
__________________
minimiller is offline
Send a message via MSN to minimiller
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 07-16-2009 , 02:34   Re: TE_BEAMPOINTS , beam bug
Reply With Quote #6

act_beam are in act_plant :]
act_plant are 'when pressed' E button.
xbatista is offline
Send a message via Skype™ to xbatista
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 04:19.


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