#include <sdktools>

#define MODELS_LAMBO	"models/tdmcars/gallardo.mdl"
#define MODELS_TT		"models/tdmcars/landrover.mdl"
#define MODELS_DBS		"models/tdmcars/dbs.mdl"
#define MODELS_C4		"models/tdmcars/cit_c4.mdl"

public OnPluginStart()
{
	HookEvent("round_start", OnRoundStart);
}

public OnMapStart()
{
	PrecacheModel(MODELS_LAMBO, true);
	PrecacheModel(MODELS_TT, true);
	PrecacheModel(MODELS_DBS, true);
	PrecacheModel(MODELS_C4, true);
}

public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
	new Float:entorigin[3];
	new entindex=-1;
    while ((entindex = FindEntityByClassname(entindex, "func_door")) != -1)
    {
        GetEntPropVector(entindex, Prop_Send, "m_vecOrigin", entorigin);
        if ((-2536.000000 == entorigin[0]) && (-2867.500000 == entorigin[1]) && (208.000000 == entorigin[2]))
		{
			AcceptEntityInput(entindex, "Unlock");
			AcceptEntityInput(entindex, "Open");
			AcceptEntityInput(entindex, "Lock");
		}
    }
    while ((entindex = FindEntityByClassname(entindex, "prop_dynamic")) != -1)
    {	
	    GetEntPropVector(entindex, Prop_Send, "m_vecOrigin", entorigin);
	    if ((-2345.000000 == entorigin[0]) && (-2990.000000 == entorigin[1]) && (32.000000 == entorigin[2]))
		{
			// GOLF BLUE
			
			AcceptEntityInput(entindex, "Kill");
			
			new Ent;
			Ent = CreateEntityByName("prop_physics_override", -1);
			DispatchKeyValue(Ent, "Solid", "6");
			DispatchKeyValue(Ent, "model", MODELS_DBS);
			DispatchKeyValue(Ent, "targetname", "dbs");
			SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
			SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
			SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
			DispatchSpawn(Ent);
			TeleportEntity(Ent, Float:{ -2345.000000, -2990.000000, 32.000000 }, Float:{ 0.0, 0.0, 0.0 }, NULL_VECTOR);
			AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
			SetEntityMoveType(Ent, MOVETYPE_NONE);
			SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);
			DispatchKeyValue(Ent, "rendercolor", "0 0 0");
		}
		else if ((-2170.000000 == entorigin[0]) && (-2997.000000 == entorigin[1]) && (32.000000 == entorigin[2]))
		{
			// GOLF VERTE
			
			AcceptEntityInput(entindex, "Kill");
			
			new Ent;
			Ent = CreateEntityByName("prop_physics_override", -1);
			DispatchKeyValue(Ent, "Solid", "6");
			DispatchKeyValue(Ent, "model", MODELS_LAMBO);
			DispatchKeyValue(Ent, "targetname", "lambo");
			SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
			SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
			SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
			DispatchSpawn(Ent);
			TeleportEntity(Ent, Float:{ -2170.000000, -2997.000000, 32.000000 }, Float:{ 0.0, 0.0, 0.0 }, NULL_VECTOR);
			AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
			SetEntityMoveType(Ent, MOVETYPE_NONE);
			SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);
			DispatchKeyValue(Ent, "rendercolor", "255 0 0");
		}
		else if ((-2337.000000 == entorigin[0]) && (-3662.000000 == entorigin[1]) && (59.000000 == entorigin[2]))
		{
			// MUSTANG ROUGE
			
			AcceptEntityInput(entindex, "Kill");
			
			new Ent;
			Ent = CreateEntityByName("prop_physics_override", -1);
			DispatchKeyValue(Ent, "Solid", "6");
			DispatchKeyValue(Ent, "model", MODELS_TT);
			DispatchKeyValue(Ent, "targetname", "tt");
			SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
			SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
			SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
			DispatchSpawn(Ent);
			TeleportEntity(Ent, Float:{ -2337.000000, -3662.000000, 31.000000 }, Float:{ 0.0, -90.0, 0.0 }, NULL_VECTOR);
			AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
			SetEntityMoveType(Ent, MOVETYPE_NONE);
			SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);
			DispatchKeyValue(Ent, "rendercolor", "255 255 255");
		}
		else if ((-2097.000000 == entorigin[0]) && (-3667.000000 == entorigin[1]) && (31.000000 == entorigin[2]))
		{
			// MUSTANG BLANCHE
			
			AcceptEntityInput(entindex, "Kill");
		
			new Ent;
			Ent = CreateEntityByName("prop_physics_override", -1);
			DispatchKeyValue(Ent, "Solid", "6");
			DispatchKeyValue(Ent, "model", MODELS_C4);
			DispatchKeyValue(Ent, "targetname", "c4");
			SetEntProp(Ent, Prop_Send, "m_CollisionGroup", 5);
			SetEntProp(Ent, Prop_Send, "m_usSolidFlags", 16);
			SetEntProp(Ent, Prop_Send, "m_nSolidType", 6);
			DispatchSpawn(Ent);
			TeleportEntity(Ent, Float:{ -2097.000000, -3667.000000, 31.000000 }, Float:{ 0.000000, 72.500000, 0.000000 }, NULL_VECTOR);
			AcceptEntityInput(Ent, "DisableMotion", -1, -1, 0);
			SetEntityMoveType(Ent, MOVETYPE_NONE);
			SetEntProp(Ent, Prop_Data, "m_takedamage", 0, 1);
			DispatchKeyValue(Ent, "rendercolor", "0 0 255");
		}
	}
	
	
} 
