Just register the command in plugin_init()
Code:
register_clcmd("say shoot", "myFunc")
You need to create an entity for you plasma ball...
Code:
new ePlasmaBall = create_entity("info_target")
Set a name for it
Code:
entity_set_string(ePlasmaBall, EV_SZ_classname, "PlasmaBall")
Set the origin
Code:
entity_set_vector(ePlasmaBall, EV_VEC_origin, anOrigin)
Set the size
Code:
new Float:maxs[3] = {32.0,32.0,64.0}
new Float:mins[3] = {-32.0,-32.0,-64.0}
entity_set_size(ePlasmaBall,mins,maxs)
Make it solid
Code:
entity_set_int(ePlasmaBall,EV_INT_solid, SOLID_BBOX)
Set move type
Code:
entity_set_int(ePlasmaBall,EV_INT_movetype,MOVETYPE_TOSS)
Set a frame rate for the sprite
Code:
entity_set_float(ePlasmaBall,EV_FL_framerate,1.0)
Render it to have a sprite as a model
Code:
set_rendering(ePlasmaBall, kRenderFxNoDissipation, 255, 255, 255, kRenderGlow, 10)
Set Model ( Rember to precache )
Code:
entity_set_model(ePlasmaBall, "sprites/myspr.spr")
Make it emit a sound ( rember to precache it )
Code:
emit_sound(ePlasmaBall, CHAN_STATIC, "ambience/alien_hollow.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
and thats it to create the entity....
And for the explosion...
Register touch in plugin_init()
Code:
register_touch("PlasmaBall","*","plasma_interact")
the touch function..
Note: gExplosionModel is the sprite u use for the explosion model...
Code:
public plasma_interact(ePlasmaBall,other) {
if(other == 0) {
new Float:fOrigin[3]
new iOrigin[3]
entity_get_vector(ePlasmaBall, EV_VEC_origin, fOrigin)
FVecIVec(fOrigin, iOrigin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3) // TE_EXPLOSION
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2]+50)
write_short(gExplosionModel)
write_byte(100)
write_byte(0)
write_byte(0)
message_end()
RadiusDamage(fOrigin, 30, 120)
remove_entity(ePlasmaBall)
}
else if(is_user_connected(other)) {
user_kill(other, 0)
new origin[3]
get_user_origin(other, origin, 0)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3) // TE_EXPLOSION
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_short(gExplosionModel)
write_byte(100)
write_byte(0)
write_byte(0)
message_end()
}
}
and there ya go
And you may not like the explosion sound it makes when it hits a wall, if you dont, just post back and i can fix that for ya
__________________