Hi, I need help with plasma shoot on predator mod.
Shot can not pass through the door.
Watch the video
http://www.youtube.com/watch?v=bfibP...ature=youtu.be
Full source in attachment, source part with create entity:
PHP Code:
public cmdShoot(id)
{
if(g_predator[id] >= 0)
{
if(plasma[id] > 0)
{
plasma[id]--;
ColorPrint(id, "You got %i plasma left", plasma[id]);
new origin[3], Float:fOrigin[3]//player origin... and float origin
new Float:velocity[3] // speed of the entity to move
get_user_origin(id,origin,1)//get user origin - int
IVecFVec(origin, fOrigin)// convert the int into float
new ePlasmaBall = create_entity("info_target") // create the plasma ball
entity_set_string(ePlasmaBall, EV_SZ_classname, "PlasmaBall") //set name of the entity "PlasmaBall"
new Float:posAdjust[3] //Used for adjusting the starting position
velocity_by_aim(id, 50, posAdjust) //was 70//You can replace 50 with whatever , get origin of the AIM
fOrigin[0] += posAdjust[0]
fOrigin[1] += posAdjust[1]
fOrigin[2] += posAdjust[2]
entity_set_vector(ePlasmaBall, EV_VEC_origin, fOrigin)//set the shot's direction
entity_set_size(ePlasmaBall, Float:{-0.005, -0.005, -0.005}, Float:{0.005, 0.005, 0.005})//set size
entity_set_int(ePlasmaBall, EV_INT_solid, SOLID_BBOX)//make solid
entity_set_int(ePlasmaBall, EV_INT_movetype, MOVETYPE_FLYMISSILE)//set movetype
entity_set_float(ePlasmaBall, EV_FL_framerate, 1.0)//framerate
entity_set_int(ePlasmaBall, EV_INT_rendermode, 5)//randermode
entity_set_float(ePlasmaBall, EV_FL_renderamt, 255.0)//visable
entity_set_float(ePlasmaBall, EV_FL_scale, 1.20)//dunno
entity_set_model(ePlasmaBall, "sprites/plasma.spr")//model
emit_sound(ePlasmaBall, CHAN_AUTO, "predator/plasma_shoot.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)//sound
VelocityByAim(id,1150,velocity)//speed
entity_set_vector(ePlasmaBall,EV_VEC_velocity,velocity)//set the shot's speed
entity_set_edict(ePlasmaBall, EV_ENT_owner, id)
// Create a trail...
/* Broadcast to all players*/
message_begin(MSG_BROADCAST, SVC_TEMPENTITY) // TE_BEAMFOLLOW ( msg #22) create a line of decaying beam segments until entity stops moving
write_byte(22) // msg id
write_short(ePlasmaBall) // short (entity:attachment to follow)
write_short(gTrailModel) // short (sprite index)
write_byte(25) // byte (life in 0.1's)
write_byte(5) // byte (line width in 0.1's)
write_byte(42) // byte (color)
write_byte(170) // byte (color)
write_byte(255) // byte (color)
write_byte(255) // byte (brightness)
message_end()
return PLUGIN_HANDLED
}
else
{
set_hudmessage(0,30,200,-1.0,0.75,0,3.0,10.0,0.15,0.5,1)
show_hudmessage(id,"You are out of ammo")
return PLUGIN_HANDLED
}
}
return PLUGIN_HANDLED
}