Helloo! I have small problem with check is entity inside bounds. Here is my code:
PHP Code:
public bool:EntityInBounds(entity, Float:minBounds[], Float:maxBounds[])
{
decl Float:position[3];
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", position);
for (new i = 0; i < 3; i++)
{
if (!(minBounds[i] <= position[i] && position[i] <= maxBounds[i]))
{
return false;
}
}
return true;
}
I check blue team sticky is close red team spawn door and it works but if red team sticky is close blue team spawn door it not work.
PHP Code:
if (GetEntProp(iSticky, Prop_Send, "m_iTeamNum") == 3)
{
decl Float:minBoundsRed[] = {-645.0, -200.0, 0.0};
decl Float:maxBoundsRed[] = {-550.0, 230.0, 215.0};
if (EntityInBounds(iSticky, minBoundsRed, maxBoundsRed))
{
AcceptEntityInput(iSticky, "Kill");
new owner = GetEntPropEnt(iSticky, Prop_Send, "m_hThrower");
if (owner > 0 && owner <= MaxClients)
PrintHintText(owner, "Please do not sticky camp spawnroom!");
}
}
else if (GetEntProp(iSticky, Prop_Send, "m_iTeamNum") == 2)
{
decl Float:minBoundsBlue[] = {645.0, 200.0, 0.0};
decl Float:maxBoundsBlue[] = {550.0, -230.0, 215.0};
if (EntityInBounds(iSticky, minBoundsBlue, maxBoundsBlue))
{
AcceptEntityInput(iSticky, "Kill");
new owner = GetEntPropEnt(iSticky, Prop_Send, "m_hThrower");
if (owner > 0 && owner <= MaxClients)
PrintHintText(owner, "Please do not sticky camp spawnroom!");
}
}
__________________