You have a very long IsInSpawn() function.
I think this is enough, isn't it?
I think this is enough, isn't it?
function IsInSpawn(X, Y, Z, WorldName) local World = cRoot:Get():GetWorld(WorldName) local SpawnLoc = Vector3d(World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ()) local PlayerLoc = Vector3d(X, Y, Z) -- Get protection radius for the world. local protectRadius = GetSpawnProtection(WorldName) if (protectRadius == -1) then -- There is no spawn for this world, so the player can\'t be in it. return false end if ((SpawnLoc - PlayerLoc):Length() <= protectRadius) then return true end return false end