PHP Code:
new String:rocket_entity_name[32] = "tf_projectile_rocket";
public FireRocket (client, Float: attack_direction[3], team, Float: speed) {
new Float: origin[3];
GetClientAbsOrigin(client, origin);
origin[2] += 68.0;
rocket_entity = CreateEntityByName(rocket_entity_name);
if(!IsValidEntity(rocket_entity)) return -1;
new Float:angles[3];
GetVectorAngles(attack_direction, angles);
decl Float:velocity[3];
velocity = attack_direction;
ScaleVector(velocity, speed);
TeleportEntity(rocket_entity, origin, angles, velocity);
SetEntPropEnt(rocket_entity, Prop_Send, "m_hOwnerEntity", client);
SetEntData(rocket_entity, FindSendPropInfo(rocket_class_name, "m_iTeamNum"), team, true);
SetEntDataFloat(rocket_entity, FindSendPropInfo(rocket_class_name, "m_iDeflected") + 4, 100.0, true);
//SetEntData(rocket_entity, FindSendPropInfo("CTFProjectile_Rocket", "m_bCritical"), 1, 1, true);
DispatchSpawn(rocket_entity);
return rocket_entity;
}
this is more or less the same code i've posted in your past two threads asking about this. this is fully working, just tested it again myself. because you're spawning it manually you will need to emit the rocket_fired sound.