Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SpawnGoalEntity(number)
- {
- new Float:fMins[3], Float:fMaxs[3];
- decl Float:goalOrigin[3]
- switch(number)
- {
- case 1: Zone_GetZonePosition("goal_red", false, goalOrigin, fMins, fMaxs);
- case 2: Zone_GetZonePosition("goal_blue", false, goalOrigin, fMins, fMaxs);
- }
- new Float:fMiddle[3];
- new goalEntity = CreateEntityByName("prop_dynamic")
- DispatchKeyValue(goalEntity, "spawnflags", "64");
- DispatchKeyValue(goalEntity, "solid", "2");
- DispatchKeyValue(goalEntity, "StartDisabled", "0")
- GetMiddleOfABox(fMins, fMaxs, fMiddle);
- TeleportEntity(goalEntity , fMiddle, NULL_VECTOR, NULL_VECTOR)
- DispatchKeyValue(goalEntity, "model", "models/props_c17/woodbarrel001_static.mdl")
- // Have the mins always be negative
- fMins[0] = fMins[0] - fMiddle[0];
- if(fMins[0] > 0.0)
- fMins[0] *= -1.0;
- fMins[1] = fMins[1] - fMiddle[1];
- if(fMins[1] > 0.0)
- fMins[1] *= -1.0;
- fMins[2] = fMins[2] - fMiddle[2];
- if(fMins[2] > 0.0)
- fMins[2] *= -1.0;
- // And the maxs always be positive
- fMaxs[0] = fMaxs[0] - fMiddle[0];
- if(fMaxs[0] < 0.0)
- fMaxs[0] *= -1.0;
- fMaxs[1] = fMaxs[1] - fMiddle[1];
- if(fMaxs[1] < 0.0)
- fMaxs[1] *= -1.0;
- fMaxs[2] = fMaxs[2] - fMiddle[2];
- if(fMaxs[2] < 0.0)
- fMaxs[2] *= -1.0;
- SetEntPropVector(goalEntity, Prop_Send, "m_vecMins", fMins);
- SetEntPropVector(goalEntity, Prop_Send, "m_vecMaxs", fMaxs);
- new iEffects = GetEntProp(goalEntity, Prop_Send, "m_fEffects");
- iEffects |= 32;
- SetEntProp(goalEntity, Prop_Send, "m_fEffects", iEffects);
- return goalEntity
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement