Thank you, that worked well! But for some reason is spawning multiple barrels at once. I'll try to figure out why that later.
Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if(buttons & IN_ATTACK2)
{
new Float:location[3];
GetClientEyePosition(client, location);
new Float:ang[3];
GetClientEyeAngles(client, ang);
new Float:location2[3];
location2[0] = (location[0]+(100*((Cosine(DegToRad(ang[1]))) * (Cosine(DegToRad(ang[0]))))));
location2[1] = (location[1]+(100*((Sine(DegToRad(ang[1]))) * (Cosine(DegToRad(ang[0]))))));
ang[0] -= (2*ang[0]);
location2[2] = (location[2]+(100*(Sine(DegToRad(ang[0])))));
PrintToChat(client,"Location1: %f, %f, %f", location[0], location[1], location[2]);
PrintToChat(client,"Location2: %f, %f, %f", location2[0], location2[1], location2[2]);
PrintToChat(client,"Angles: %f, %f, %f", ang[0], ang[1], ang[2]);
new EntitySpawnIndex = CreateEntityByName("prop_physics");
SetEntityModel(EntitySpawnIndex,"models/props_c17/oildrum001_explosive.mdl");
DispatchSpawn(EntitySpawnIndex);
SetEntityMoveType(EntitySpawnIndex, MOVETYPE_VPHYSICS);
SetEntProp(EntitySpawnIndex, Prop_Data, "m_CollisionGroup", 5);
SetEntProp(EntitySpawnIndex, Prop_Data, "m_nSolidType", 6);
TeleportEntity(EntitySpawnIndex, location2, NULL_VECTOR, NULL_VECTOR);
}
return Plugin_Continue;
}