View Single Post
Author Message
ZombieTheMan01
Senior Member
Join Date: Aug 2015
Location: Turkey
Old 01-11-2021 , 14:23   Cso style beam create probleming
Reply With Quote #1

Hi guys. I have problems again, unfortunately. my question is that I found 2 of the cso style beam on the internet. But one is not exactly the same and does not disappear by itself, while the other looks like the lost version of the ordinary beam. How do you think I should handle this? Or is there any method you can suggest?

VIDEO-1 (REQUEST) (ORIGINAL CSO/CSN:Z BEAM)
VIDEO-2 (REQUEST) (CS 1.6 in CSO STYLE BEAM)
VIDEO-3 (REQUEST) (CS 1.6 IN - ALTERNATIF VIDEO)

VIDEO-1 (ACTUALLY [FIRST CODES])
VIDEO-2 (ACTUALY [SECOND CODES])


Codes in here:

FIRST:
Code:
...
register_forward(FM_StartFrame, "fw_StartFrame")
...

public Additional_Settings(id, ent)
{
	set_pdata_int(id, 363, 90, 5)
	
	// csbtedhan + kord12.7
	new Float:originF[3], Float:aimoriginF[3]
	pev(ent, pev_vuser1, aimoriginF)
	Stock_Get_Postion(id, 40.0, get_cvar_num("cl_righthand")?7.5:-7.5, -5.0, originF)
	//get_position(iAttacker, 40.0, 6.0, -7.0, StartOrigin)
	for(new i = 0; i < min(floatround(vector_distance(originF, aimoriginF)*0.1), 10) ; i++)
	{
		new iBeam = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "beam"))
		set_pev(iBeam, pev_classname, "beam");
		set_pev(iBeam, pev_flags, pev(iBeam, pev_flags) | FL_CUSTOMENTITY);
		set_pev(iBeam, pev_rendercolor, Float:{255.0, 255.0, 255.0})
		set_pev(iBeam, pev_renderamt, 255.0)
		set_pev(iBeam, pev_body, 0)
		set_pev(iBeam, pev_frame, 0.0)
		set_pev(iBeam, pev_animtime, 0.0)
		set_pev(iBeam, pev_model, "sprites/laserbeam.spr");
		set_pev(iBeam, pev_modelindex, spr)
		set_pev(iBeam, pev_scale, 10.0)
		
		set_pev(iBeam, pev_rendermode, (pev(iBeam, pev_rendermode) & 0x0F) | 0x40 & 0xF0)
		set_pev(iBeam, pev_origin, originF)
		set_pev(iBeam, pev_angles, aimoriginF)
		set_pev(iBeam, pev_sequence, (pev(iBeam, pev_sequence) & 0x0FFF) | ((0 & 0xF) << 12))
		set_pev(iBeam, pev_skin, (pev(iBeam, pev_skin) & 0x0FFF) | ((0 & 0xF) << 12))
		Beam_RelinkBeam(iBeam);
		
		set_pev(iBeam, pev_dmgtime, get_gametime()+0.4)
		set_pev(iBeam, pev_fuser1, 0.8)
		set_pev(iBeam, pev_iuser1, 2018)
	}
}

...

public fw_StartFrame() // csbtedhan
{
	new iEnt = -1
	while((iEnt = find_ent_by_class(iEnt, "beam")) > 0)
	{
		if(!is_valid_ent(iEnt) || pev(iEnt, pev_iuser1) != 2018)
			continue;
		
		new Float:dmgtime, Float:color[3], Float:stay
		pev(iEnt,pev_dmgtime, dmgtime)
		pev(iEnt,pev_fuser1, stay)
		pev(iEnt,pev_rendercolor, color)
		
		if(dmgtime - get_gametime() < stay)
		{
			color[0] = floatmax(0.0, color[0] - 16.0)
			color[1] = floatmax(0.0, color[1] - 16.0)
			color[2] = floatmax(0.0, color[2] - 16.0)
			set_pev(iEnt,pev_rendercolor, color)
		}
		
		if(dmgtime <= get_gametime())
			set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME)
	}
}

stock Stock_Get_Postion(id,Float:forw,Float:right, Float:up,Float:vStart[])
{
	static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
	
	pev(id, pev_origin, vOrigin)
	pev(id, pev_view_ofs,vUp) //for player
	xs_vec_add(vOrigin,vUp,vOrigin)
	pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
	
	angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward) //or use EngFunc_AngleVectors
	angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
	angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
	
	vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
	vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
	vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
} 

stock Beam_RelinkBeam(const iBeamEntity)
{
	new Float:flOrigin[3],Float:flStartPos[3],Float:flEndPos[3];
	new Float:flMins[3],Float:flMaxs[3];
	
	pev(iBeamEntity, pev_origin, flOrigin);
	pev(iBeamEntity, pev_origin, flStartPos);
	pev(iBeamEntity, pev_angles, flEndPos);
	
	flMins[0] = floatmin(flStartPos[0], flEndPos[0]);
	flMins[1] = floatmin(flStartPos[1], flEndPos[1]);
	flMins[2] = floatmin(flStartPos[2], flEndPos[2]);
	
	flMaxs[0] = floatmax(flStartPos[0], flEndPos[0]);
	flMaxs[1] = floatmax(flStartPos[1], flEndPos[1]);
	flMaxs[2] = floatmax(flStartPos[2], flEndPos[2]);
	
	xs_vec_sub(flMins, flOrigin, flMins);
	xs_vec_sub(flMaxs, flOrigin, flMaxs);
	
	set_pev(iBeamEntity, pev_mins, flMins);
	set_pev(iBeamEntity, pev_maxs, flMaxs);
	
	engfunc(EngFunc_SetSize, iBeamEntity, flMins, flMaxs);
	engfunc(EngFunc_SetOrigin, iBeamEntity, flOrigin);
}
SECOND (Suppose I added this "stock" part to either traceattack or primaryattack with get_position). :
Code:
stock create_beampoints(Float:StartPosition[3], Float:TargetPosition[3], SpritesID, StartFrame, Framerate, Life, LineWidth, Amplitude, Red, Green, Blue, Brightness, Speed)
{
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_BEAMPOINTS)
	engfunc(EngFunc_WriteCoord, StartPosition[0])
	engfunc(EngFunc_WriteCoord, StartPosition[1])
	engfunc(EngFunc_WriteCoord, StartPosition[2])
	engfunc(EngFunc_WriteCoord, TargetPosition[0])
	engfunc(EngFunc_WriteCoord, TargetPosition[1])
	engfunc(EngFunc_WriteCoord, TargetPosition[2])
	write_short(SpritesID)
	write_byte(StartFrame)
	write_byte(Framerate)
	write_byte(Life)
	write_byte(LineWidth)
	write_byte(Amplitude)
	write_byte(Red)
	write_byte(Green)
	write_byte(Blue)
	write_byte(Brightness)
	write_byte(Speed)
	message_end()
}
Thanks in advance.
__________________
FREE PLUGINS:

2021 and before -> ALL PLUGIN LINK IS HERE <-

2022:
Zombie: The Original [%70 Completed]

Last edited by ZombieTheMan01; 01-11-2021 at 14:32.
ZombieTheMan01 is offline