Don't allow destinations to be inside the teleport zone (#327)

This commit is contained in:
shavitush 2017-06-03 22:43:34 +03:00
parent 204fb45712
commit 69405e3be9
2 changed files with 33 additions and 4 deletions

View File

@ -1194,11 +1194,35 @@ public int CreateZoneConfirm_Handler(Menu menu, MenuAction action, int param1, i
{
float vTeleport[3];
GetClientAbsOrigin(param1, vTeleport);
vTeleport[2] += 2.0;
// if()
gV_Teleport[param1] = vTeleport;
//GetClientAbsOrigin(param1, gV_Teleport[param1]);
Shavit_PrintToChat(param1, "%T", "ZoneTeleportUpdated", param1);
float vPoints[8][3];
vPoints[0] = gV_Point1[param1];
vPoints[7] = gV_Point2[param1];
CreateZonePoints(vPoints, gF_RotateAngle[param1], gV_Fix1[param1], gV_Fix2[param1], PLACEHOLDER, false, true);
bool bInside = true;
for(int i = 0; i < 3; i++)
{
if(vPoints[0][i] >= vTeleport[i] == vPoints[7][i] >= vTeleport[i])
{
bInside = false;
}
}
if(bInside)
{
Shavit_PrintToChat(param1, "%T", "ZoneTeleportInsideZone", param1);
}
else
{
gV_Teleport[param1] = vTeleport;
Shavit_PrintToChat(param1, "%T", "ZoneTeleportUpdated", param1);
}
CreateEditMenu(param1);
}
@ -1232,6 +1256,7 @@ void CreateEditMenu(int client)
FormatEx(sMenuItem, 64, "%T", "ZoneSetYes", client);
menu.AddItem("yes", sMenuItem);
}
FormatEx(sMenuItem, 64, "%T", "ZoneSetTPZone", client);
menu.AddItem("tpzone", sMenuItem);
}

View File

@ -219,4 +219,8 @@
{
"en" "Teleport zone destination updated."
}
"ZoneTeleportInsideZone"
{
"en" "You may not place a destination inside the teleport zone."
}
}