I thought I would post some handy snippets for Left 4 Dead 2.
Creating an explosive Barrel:
PHP Code:
new ent = CreateEntityByName("prop_fuel_barrel"); //Special prop type for the barrel
DispatchKeyValue(ent, "model", "models/props_industrial/barrel_fuel.mdl");
DispatchKeyValue(ent, "BasePiece", "models/props_industrial/barrel_fuel_partb.mdl");
DispatchKeyValue(ent, "FlyingPiece01", "models/props_industrial/barrel_fuel_parta.mdl"); //FlyingPiece01 - FlyingPiece04 are supported
DispatchKeyValue(ent, "DetonateParticles", "weapon_pipebomb"); //Particles to use, weapon_vomitjar might work haven't tested
DispatchKeyValue(ent, "FlyingParticles", "barrel_fly"); //Particles to use, I have never successfully gotten a list of L4D2 particle names yet
DispatchKeyValue(ent, "DetonateSound", "BaseGrenade.Explode"); //Scene File name that will be used as sound when barrel explodes
DispatchSpawn(ent);
Now theres also the matter of laser sights which can't be created by the simple CreateEntityByName
Here's how:
PHP Code:
new Float:pos[3], String:position[64];
new ent = CreateEntityByName("upgrade_spawn");
DispatchKeyValue(ent, "count", "1")
DispatchKeyValue(ent, "laser_sight", "1");
Format(position, sizeof(position), "%1.1f %1.1f %1.1f", pos[0], pos[1], pos[2]); //Teleporting this entity will not work must use origin key value!
DispatchKeyValue(ent, "origin", position);
DispatchKeyValue(ent, "classname", "upgrade_spawn");
DispatchSpawn(ent);
After DispatchSpawn you can use TeleportEntity how you like to teleport it somewhere. ALSO HANDY FOR STRIPPER!
__________________